[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system.h cleanups
From: |
Jim Meyering |
Subject: |
Re: system.h cleanups |
Date: |
Thu, 08 Oct 2009 17:03:50 +0200 |
Eric Blake wrote:
> OK to commit these cleanups? Maybe we should push on Bruno to add ENODATA to
> gnulib's <errno.h> replacement, particularly since you are now considering
> using ENODATA for SELinux errors. While the system.h version allows
> compilation, it would be better to have a dedicated errno rather than -1, as
> well as strerror support, if some other platform happens to encounter the
> SELinux path that sets ENODATA. gmane probably wrapped long lines :(
Thank you.
Such clean-ups are most welcome.
In fact, some deserve public syntax checks,
since I know other projects that would benefit, too.
>>From 69b7a7ab900a043d6330b400659fb69a1aedde8e Mon Sep 17 00:00:00 2001
> From: Eric Blake <address@hidden>
> Date: Thu, 8 Oct 2009 08:13:02 -0600
> Subject: [PATCH 1/3] maint: move timeout exit statuses
>
> * src/timeout.c (EXIT_TIMEDOUT, EXIT_CANCELED): Remove as
> macros...
> * src/system.h (EXIT_TIMEDOUT, EXIT_CANCELED): ...and provide as
> enum values instead.
> ---
> src/system.h | 2 ++
> src/timeout.c | 6 ------
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/src/system.h b/src/system.h
> index ce71148..102b93d 100644
> --- a/src/system.h
> +++ b/src/system.h
> @@ -107,6 +107,8 @@ you must include <sys/types.h> before including this file
> /* Exit statuses for programs like 'env' that exec other programs. */
> enum
> {
> + EXIT_TIMEDOUT = 124,
> + EXIT_CANCELED = 125,
> EXIT_CANNOT_INVOKE = 126,
> EXIT_ENOENT = 127
> };
...
The above is fine.
>>From 3fe95b8d5294df9747982cc6e41a6adb621450a0 Mon Sep 17 00:00:00 2001
> From: Eric Blake <address@hidden>
> Date: Thu, 8 Oct 2009 08:10:50 -0600
> Subject: [PATCH 2/3] maint: remove unused macros and declarations
>
> * src/system.h (strdupa): Delete unused macro.
...
> -# define ASSIGN_STRDUPA(DEST, S) \
> - do { DEST = strdupa (S); } while (0)
> -#else
> -# define ASSIGN_STRDUPA(DEST, S) \
> - do \
> - { \
> - const char *s_ = (S); \
> - size_t len_ = strlen (s_) + 1; \
> - char *tmp_dest_ = alloca (len_); \
> - DEST = memcpy (tmp_dest_, s_, len_); \
> - } \
> - while (0)
> -#endif
...
?? As far as I can see, one cannot remove ASSIGN_STRDUPA,
since it is not defined anyplace else.
The code (cp.c, df.c, copy.c) won't compile without it.
>>From cb1d20e5764917ce16d7ba970061c5c3a591097c Mon Sep 17 00:00:00 2001
> From: Eric Blake <address@hidden>
> Date: Thu, 8 Oct 2009 08:35:55 -0600
> Subject: [PATCH 3/3] maint: use X2NREALLOC in more places
>
> * src/chroot.c (set_additional_groups): Use X2NREALLOC rather than
> x2nrealloc.
> * src/factor.c (emit_factor): Likewise.
> * src/setuidgid.c (main): Likewise.
This one is fine.
You're welcome to push #1 and #3.
If you fix/resend #2, I'll apply and test it, too.