Cleaned.
authorBenoît Dejean <bdejean@src.gnome.org>
Sun, 6 Jun 2004 22:10:29 +0000 (22:10 +0000)
committerBenoît Dejean <bdejean@src.gnome.org>
Sun, 6 Jun 2004 22:10:29 +0000 (22:10 +0000)
* lib/parameter.c:
* support/popt.c: (poptGetContext): Cleaned.

* support/vsnprintf.c: s/strncpy/g_strlcpy

svn path=/trunk/; revision=3449

support/popt.c
support/vsnprintf.c

index 283cf83..783d2c1 100644 (file)
@@ -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;
index a2dfb4e..6a54d27 100644 (file)
@@ -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,