pgrep/pkill
Denys Vlasenko
vda.linux at googlemail.com
Fri Sep 28 22:22:51 UTC 2007
On Friday 28 September 2007 16:51, Loïc Grenié wrote:
> These are three patches for busybox.
Sending patches separately makes it easy to have one thread per patch.
With mnay patches in one mail, it's a mess.
> 1) The first one adds a function xfree(ptr) to xfuncs.c which acts
> as if (ptr) free(ptr) and substitute some examples of such
> elements in the code. I don't remember whether such a
> function is necessary or whether free() itself already checks
> for null pointer.
Part with s/if (p) free(p)/free(p)/g applied.
> 2) The second one corrects a comment.
Applied, thanks.
> 3) The third one adds functions pgrep and pkill (this one includes
> the "procps.diff" that I've sent before).
+static char char2;
+/* Idea taken from kill.c */
+#define pgrep (ENABLE_PGREP && char2 == 'g')
+#define pkill (ENABLE_PKILL && char2 == 'k')
You don't need that static. Use existing global char* applet_name.
+ if (opt & 0x04)
+ anchor = 0;
You mean:
enum { /* correspond to getopt32 option string */
OPTBIT_ANCHOR = 0,
OPTBIT_X,
OPTBIT_Y,
OPTBIT_Z,
};
#define OPT_ANCHOR (opt & (1 << OPTBIT_ANCHOR))
#define OPT_X (opt & (1 << OPTBIT_X ))
...
if (OPT_ANCHOR) ...
This produces smaller code.
Generally I can accept pgrep/pkill, looking forward for next
iteration of the patch.
--
vda
More information about the busybox
mailing list