Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fvbe.git;a=commitdiff;h=4edcb8c5c22f0992d08427c7f983ddaacb5216ca
commit 4edcb8c5c22f0992d08427c7f983ddaacb5216ca Author: James Buren <[email protected]> Date: Sat Sep 21 20:44:54 2013 -0500 utility: move dirs_count() to global header. diff --git a/src/local.h b/src/local.h index 1518d8a..74b43c7 100644 --- a/src/local.h +++ b/src/local.h @@ -207,6 +207,25 @@ extern bool execute(const char *command,const char *root,pid_t *cpid); extern void *memdup(const void *mem,size_t size); extern void *malloc0(size_t size); extern const char *uuidgen(void); +static inline size_t dirs_count(const char *s) +{ + size_t n = 0; + bool trail = false; + + for( ; s[0] != 0 ; ++s ) + { + if(s[0] == '/') + ++n; + + if(s[0] == '/' && s[1] == 0) + trail = true; + } + + if(!trail) + ++n; + + return n; +} static inline long long min(long long a,long long b) { return (a < b) ? a : b; } static inline long long max(long long a,long long b) { return (a > b) ? a : b; } static inline long long minv(long long *v,size_t size) diff --git a/src/utility.c b/src/utility.c index 884aed2..21a1503 100644 --- a/src/utility.c +++ b/src/utility.c @@ -17,33 +17,6 @@ #include "local.h" -static inline size_t dirs_count(const char *s) -{ - size_t n = 0; - bool trail = false; - - if(s == 0 || s[0] != '/') - { - errno = EINVAL; - error(strerror(errno)); - return 0; - } - - for( ; s[0] != 0 ; ++s ) - { - if(s[0] == '/') - ++n; - - if(s[0] == '/' && s[1] == 0) - trail = true; - } - - if(!trail) - ++n; - - return n; -} - static int dirs_ascend_compare(const void *A,const void *B) { const char *a = * (char **) A; _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
