pkg: get rid of PKG_LOCAL_COPY() since it was only used in one place
parent
56fbf25c8a
commit
bb41d143cc
9
pkg.c
9
pkg.c
|
@ -337,6 +337,7 @@ int
|
||||||
pkg_compare_version(const char *a, const char *b)
|
pkg_compare_version(const char *a, const char *b)
|
||||||
{
|
{
|
||||||
char oldch1, oldch2;
|
char oldch1, oldch2;
|
||||||
|
char buf1[BUFSIZ], buf2[BUFSIZ];
|
||||||
char *str1, *str2;
|
char *str1, *str2;
|
||||||
char *one, *two;
|
char *one, *two;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -346,11 +347,11 @@ pkg_compare_version(const char *a, const char *b)
|
||||||
if (!strcasecmp(a, b))
|
if (!strcasecmp(a, b))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
str1 = PKG_LOCAL_COPY(a);
|
strlcpy(buf1, a, sizeof buf1);
|
||||||
str2 = PKG_LOCAL_COPY(b);
|
strlcpy(buf2, b, sizeof buf2);
|
||||||
|
|
||||||
one = str1;
|
one = str1 = buf1;
|
||||||
two = str2;
|
two = str2 = buf2;
|
||||||
|
|
||||||
while (*one && *two)
|
while (*one && *two)
|
||||||
{
|
{
|
||||||
|
|
3
pkg.h
3
pkg.h
|
@ -56,9 +56,6 @@ typedef struct pkg_fragment_ pkg_fragment_t;
|
||||||
#define PKG_FOREACH_LIST_ENTRY_SAFE(head, nextiter, value) \
|
#define PKG_FOREACH_LIST_ENTRY_SAFE(head, nextiter, value) \
|
||||||
for ((value) = (head), (nextiter) = (head) != NULL ? (head)->next : NULL; (value) != NULL; (value) = (nextiter), (nextiter) = (nextiter) != NULL ? (nextiter)->next : NULL)
|
for ((value) = (head), (nextiter) = (head) != NULL ? (head)->next : NULL; (value) != NULL; (value) = (nextiter), (nextiter) = (nextiter) != NULL ? (nextiter)->next : NULL)
|
||||||
|
|
||||||
#define PKG_LOCAL_COPY(a) \
|
|
||||||
strcpy(alloca(strlen(a) + 1), a)
|
|
||||||
|
|
||||||
#define PKG_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
#define PKG_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#define PKG_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
#define PKG_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue