From: BenoƮt Dejean Date: Sun, 6 Jun 2004 22:10:29 +0000 (+0000) Subject: Cleaned. X-Git-Tag: GNOME_COMMON_2_8_0~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2839d0086227e9d3ef065b013de28358bfb751b9;p=platform%2Fupstream%2Fgnome-common.git Cleaned. * lib/parameter.c: * support/popt.c: (poptGetContext): Cleaned. * support/vsnprintf.c: s/strncpy/g_strlcpy svn path=/trunk/; revision=3449 --- diff --git a/support/popt.c b/support/popt.c index 283cf83..783d2c1 100644 --- a/support/popt.c +++ b/support/popt.c @@ -45,9 +45,7 @@ static void invokeCallbacks(poptContext con, const struct poptOption * table, poptContext poptGetContext(const char * name, int argc, const char ** argv, const struct poptOption * options, int flags) { - poptContext con = malloc(sizeof(*con)); - - memset(con, 0, sizeof(*con)); + poptContext con = calloc(1, sizeof *con); con->os = con->optionStack; con->os->argc = argc; diff --git a/support/vsnprintf.c b/support/vsnprintf.c index a2dfb4e..6a54d27 100644 --- a/support/vsnprintf.c +++ b/support/vsnprintf.c @@ -86,8 +86,7 @@ mcleanup(str, n, p) size_t n; char *p; { - strncpy(str, p, n-1); - str[n-1] = '\0'; + g_strlcpy(str, p, n); if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, PROT_READ|PROT_WRITE|PROT_EXEC) == -1) mprotect((caddr_t)(p + n + EXTRABYTES), pgsize,