diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2004-06-06 22:10:29 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2004-06-06 22:10:29 +0000 |
commit | 2839d0086227e9d3ef065b013de28358bfb751b9 (patch) | |
tree | 10a7e67c8ca7e9320a17f8cf74763e86022011e4 | |
parent | cfb53e981e5a9654c44643b4d9e0600ecdf8121f (diff) | |
download | shared-mime-info-2839d0086227e9d3ef065b013de28358bfb751b9.tar.gz |
Cleaned.
* lib/parameter.c:
* support/popt.c: (poptGetContext): Cleaned.
* support/vsnprintf.c: s/strncpy/g_strlcpy
svn path=/trunk/; revision=3449
-rw-r--r-- | support/popt.c | 4 | ||||
-rw-r--r-- | support/vsnprintf.c | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/support/popt.c b/support/popt.c index 283cf83c..783d2c1a 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 a2dfb4ed..6a54d270 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, |