external/busybox
Revisión | 163828b9fb74fac86017a236ffbea151edc0f377 (tree) |
---|---|
Tiempo | 2020-04-14 08:42:13 |
Autor | Mauro Rossi <issor.oruam@gmai...> |
Commiter | Mauro Rossi |
libbb,procps: introduce kernel-style BUILD_BUG_ON()
Based on ab3964db ("libbb: introduce kernel-style BUILD_BUG_ON()")
with changes applied only to libbb/procps.c and include/libbb.h
@@ -1898,6 +1898,7 @@ extern const char bb_default_login_shell[] ALIGN1; | ||
1898 | 1898 | |
1899 | 1899 | |
1900 | 1900 | #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0]))) |
1901 | +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | |
1901 | 1902 | |
1902 | 1903 | |
1903 | 1904 | /* We redefine ctype macros. Unicode-correct handling of char types |
@@ -283,7 +283,6 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total, | ||
283 | 283 | } |
284 | 284 | #endif |
285 | 285 | |
286 | -void BUG_comm_size(void); | |
287 | 286 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) |
288 | 287 | { |
289 | 288 | if (!sp) |
@@ -385,8 +384,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | ||
385 | 384 | /*if (!cp || cp[1] != ' ') |
386 | 385 | continue;*/ |
387 | 386 | cp[0] = '\0'; |
388 | - if (sizeof(sp->comm) < 16) | |
389 | - BUG_comm_size(); | |
387 | + BUILD_BUG_ON(sizeof(sp->comm) < 16); | |
390 | 388 | comm1 = strchr(buf, '('); |
391 | 389 | /*if (comm1)*/ |
392 | 390 | safe_strncpy(sp->comm, comm1 + 1, sizeof(sp->comm)); |