diff options
author | Mike Frysinger <vapier@gentoo.org> | 2013-09-29 10:07:28 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2013-09-29 10:07:28 +0000 |
commit | 7da2fa617b89d2f92c3e866d4eb994a591787b4e (patch) | |
tree | 5003a734e6bebc829e43e23798671a8e3472d8a3 | |
parent | TODO: mention extended USE deps syntax (diff) | |
download | portage-utils-7da2fa617b89d2f92c3e866d4eb994a591787b4e.tar.gz portage-utils-7da2fa617b89d2f92c3e866d4eb994a591787b4e.tar.bz2 portage-utils-7da2fa617b89d2f92c3e866d4eb994a591787b4e.zip |
scandirat: use _DIRENT_HAVE_D_RECLEN to be slightly more portable #485430
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | libq/scandirat.c | 12 | ||||
-rw-r--r-- | qdepends.c | 14 | ||||
-rw-r--r-- | tests/Makefile | 2 |
4 files changed, 12 insertions, 17 deletions
@@ -34,7 +34,6 @@ - only 64bit values are supported in any individual version component foo-(1234)_alpha(56789) - these limits should not be an issue for all practical purposes - - need to handle USE deps like: cat/pkg-123[foo(+)] - env vars only get expanded once, so this fails: ACCEPT_LICENSE="foo" diff --git a/libq/scandirat.c b/libq/scandirat.c index f2f76ae..2003d1e 100644 --- a/libq/scandirat.c +++ b/libq/scandirat.c @@ -1,7 +1,7 @@ /* * Copyright 2005-2011 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/scandirat.c,v 1.4 2012/01/16 01:10:32 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/scandirat.c,v 1.5 2013/09/29 10:07:28 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2011 Mike Frysinger - <vapier@gentoo.org> @@ -13,7 +13,13 @@ # endif #endif -#if !defined(HAVE_SCANDIRAT) +#if !defined(HAVE_SCANDIRATf) + +#if defined(_DIRENT_HAVE_D_RECLEN) +# define reclen(de) ((de)->d_reclen) +#else +# define reclen(de) (sizeof(*(de))) +#endif static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist, int (*filter)(const struct dirent *), @@ -39,7 +45,7 @@ static int scandirat(int dir_fd, const char *dir, struct dirent ***dirlist, continue; ret = realloc(ret, sizeof(*ret) * (cnt + 1)); - ret[cnt++] = xmemdup(de, de->d_reclen); + ret[cnt++] = xmemdup(de, reclen(de)); } *dirlist = ret; @@ -1,7 +1,7 @@ /* * Copyright 2005-2013 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.62 2013/09/29 10:03:06 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qdepends.c,v 1.63 2013/09/29 10:07:28 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2013 Mike Frysinger - <vapier@gentoo.org> @@ -32,7 +32,7 @@ static const char * const qdepends_opts_help[] = { "Pretty format specified depend strings", COMMON_OPTS_HELP }; -static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.62 2013/09/29 10:03:06 vapier Exp $"; +static const char qdepends_rcsid[] = "$Id: qdepends.c,v 1.63 2013/09/29 10:07:28 vapier Exp $"; #define qdepends_usage(ret) usage(ret, QDEPENDS_FLAGS, qdepends_long_opts, qdepends_opts_help, lookup_applet_idx("qdepends")) static char qdep_name_only = 0; @@ -146,7 +146,6 @@ void _dep_attach(dep_node *root, dep_node *attach_me, int type) _q_static dep_node *dep_grow_tree(const char *depend) { - bool saw_whitespace; signed long paren_balanced; const char *ptr, *word; int curr_attach; @@ -176,10 +175,8 @@ _q_static dep_node *dep_grow_tree(const char *depend) word = NULL; \ } while (0) - saw_whitespace = true; for (ptr = depend; *ptr; ++ptr) { if (isspace(*ptr)) { - saw_whitespace = true; _maybe_consume_word(DEP_NORM); continue; } @@ -195,8 +192,6 @@ _q_static dep_node *dep_grow_tree(const char *depend) continue; } case '|': { - if (!saw_whitespace) - break; if (ptr[1] != '|') { warnf("Found a | but not ||"); goto error_out; @@ -208,8 +203,6 @@ _q_static dep_node *dep_grow_tree(const char *depend) } case '(': { ++paren_balanced; - if (!saw_whitespace) - break; if (prev_type == DEP_OR || prev_type == DEP_USE) { _maybe_consume_word(DEP_NORM); prev_type = DEP_NULL; @@ -226,8 +219,6 @@ _q_static dep_node *dep_grow_tree(const char *depend) } case ')': { --paren_balanced; - if (!saw_whitespace) - break; _maybe_consume_word(DEP_NORM); if (curr_node->parent == NULL) { @@ -242,7 +233,6 @@ _q_static dep_node *dep_grow_tree(const char *depend) if (!word) word = ptr; } - saw_whitespace = false; /* fall through to the paren failure below */ if (paren_balanced < 0) diff --git a/tests/Makefile b/tests/Makefile index bf568b0..10cdd37 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,6 +1,6 @@ TESTS = \ reinitialize atom_compare atom_explode mkdir \ - qdepends qfile qlist qtbz2 quse qxpak \ + qfile qlist qtbz2 quse qxpak \ install profile source all: check |