[pacman-dev] [PATCH] Use limits.h for PATH_MAX

Dan McGee dpmcgee at gmail.com
Sat Dec 18 12:56:26 EST 2010


On Fri, Dec 17, 2010 at 7:43 PM, Allan McRae <allan at archlinux.org> wrote:
> We use PATH_MAX everywhere by including limits.h so there is no
> point in doing a check for it in a different header when dealing
> with FreeBSD's libfetch.
>
> Signed-off-by: Allan McRae <allan at archlinux.org>
Looks fine, just two things I'll point out and let you decide how to
act on them:
1. We check for limits.h but never use the macro shield anywhere, it
looks like. Probably common enough (and required by us anyway) that it
doesn't matter.
2. strings.h -> not used anywhere in libalpm, but still included in this list.

> ---
>  configure.ac        |    4 ++--
>  lib/libalpm/dload.c |    6 ++----
>  lib/libalpm/error.c |    6 ++----
>  3 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 18e8996..e03a937 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -172,8 +172,8 @@ AS_IF([test "x$with_fetch" != "xno"],
>  AM_CONDITIONAL([HAVE_LIBFETCH], [test "x$ac_cv_lib_fetch_fetchParseURL" = "xyes"])
>
>  # Checks for header files.
> -AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h mntent.h string.h strings.h \
> -                  sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h sys/syslimits.h \
> +AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h mntent.h string.h \
> +                  strings.h sys/ioctl.h sys/mount.h sys/param.h sys/statvfs.h \
>                   sys/time.h sys/types.h sys/ucred.h syslog.h wchar.h])
>
>  # Checks for typedefs, structures, and compiler characteristics.
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index ea7f557..09f716f 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -29,10 +29,8 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <signal.h>
> -/* the following two are needed on BSD for libfetch */
> -#if defined(HAVE_SYS_SYSLIMITS_H)
> -#include <sys/syslimits.h> /* PATH_MAX */
> -#endif
> +/* the following two are needed for FreeBSD's libfetch */
> +#include <limits.h> /* PATH_MAX */
>  #if defined(HAVE_SYS_PARAM_H)
>  #include <sys/param.h> /* MAXHOSTNAMELEN */
>  #endif
> diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
> index d4c296f..3d05626 100644
> --- a/lib/libalpm/error.c
> +++ b/lib/libalpm/error.c
> @@ -22,10 +22,8 @@
>
>  /* TODO: needed for the libfetch stuff, unfortunately- we should kill it */
>  #include <stdio.h>
> -/* the following two are needed on BSD for libfetch */
> -#if defined(HAVE_SYS_SYSLIMITS_H)
> -#include <sys/syslimits.h> /* PATH_MAX */
> -#endif
> +/* the following two are needed for FreeBSD's libfetch */
> +#include <limits.h> /* PATH_MAX */
>  #if defined(HAVE_SYS_PARAM_H)
>  #include <sys/param.h> /* MAXHOSTNAMELEN */
>  #endif
> --
> 1.7.3.3
>
>
>


More information about the pacman-dev mailing list