Use g_alloca instead of fooling around with platforms ourselves

Glib has been providing a g_alloca wrapper that handles all the platform
specifics since at least glib-1.3. Use it.
This commit is contained in:
Dan Nicholson 2012-05-29 16:41:17 -07:00
parent 5c219ca67d
commit dfd03ae23e
2 changed files with 2 additions and 11 deletions

View file

@ -24,7 +24,6 @@ dnl Check for headers
AC_CHECK_HEADERS([dirent.h unistd.h sys/wait.h malloc.h])
dnl Check for library functions
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(setresuid setreuid,break)

12
pkg.c
View file

@ -25,14 +25,6 @@
#include "pkg.h"
#include "parse.h"
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#else
# ifdef _AIX
# pragma alloca
# endif
#endif
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
@ -1276,8 +1268,8 @@ static int rpmvercmp(const char * a, const char * b) {
/* easy comparison to see if versions are identical */
if (!strcmp(a, b)) return 0;
str1 = alloca(strlen(a) + 1);
str2 = alloca(strlen(b) + 1);
str1 = g_alloca(strlen(a) + 1);
str2 = g_alloca(strlen(b) + 1);
strcpy(str1, a);
strcpy(str2, b);