Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-busybox: Commit

external/busybox


Commit MetaInfo

Revisión163828b9fb74fac86017a236ffbea151edc0f377 (tree)
Tiempo2020-04-14 08:42:13
AutorMauro Rossi <issor.oruam@gmai...>
CommiterMauro Rossi

Log Message

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

Cambiar Resumen

Diferencia incremental

--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1898,6 +1898,7 @@ extern const char bb_default_login_shell[] ALIGN1;
18981898
18991899
19001900 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
1901+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
19011902
19021903
19031904 /* We redefine ctype macros. Unicode-correct handling of char types
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -283,7 +283,6 @@ int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
283283 }
284284 #endif
285285
286-void BUG_comm_size(void);
287286 procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
288287 {
289288 if (!sp)
@@ -385,8 +384,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
385384 /*if (!cp || cp[1] != ' ')
386385 continue;*/
387386 cp[0] = '\0';
388- if (sizeof(sp->comm) < 16)
389- BUG_comm_size();
387+ BUILD_BUG_ON(sizeof(sp->comm) < 16);
390388 comm1 = strchr(buf, '(');
391389 /*if (comm1)*/
392390 safe_strncpy(sp->comm, comm1 + 1, sizeof(sp->comm));
Show on old repository browser