From: Panu Matilainen Date: Fri, 25 Apr 2008 10:39:44 +0000 (+0300) Subject: Simplify setPathDefault() X-Git-Tag: tznext/4.11.0.1.tizen20130304~4305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12ad8a5194168cf5213dc359283a8997c5501999;p=tools%2Flibrpm-tizen.git Simplify setPathDefault() - use rpmGetPath() to get sanitized path, avoid alloca() --- diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 18ffd01..9dd9d69 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -438,12 +438,9 @@ static void setPathDefault(const char * macroname, const char * subdir) { if (macroname != NULL) { -#define _TOPDIRMACRO "%{_topdir}/" - char *body = alloca(sizeof(_TOPDIRMACRO) + strlen(subdir)); - strcpy(body, _TOPDIRMACRO); - strcat(body, subdir); + char *body = rpmGetPath("%{_topdir}/", subdir, NULL); addMacro(NULL, macroname, NULL, body, RMIL_DEFAULT); -#undef _TOPDIRMACRO + free(body); } }