]> granicus.if.org Git - strace/commitdiff
2006-12-27 Dmitry V. Levin <ldv@altlinux.org>
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Jan 2007 22:05:04 +0000 (22:05 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Jan 2007 22:05:04 +0000 (22:05 +0000)
Add const qualifier to xlookup() return value

* defs.h (xlookup): Add const qualifier to return value.
* desc.c (sprintflags): Likewise.
* process.c (printpriv): Update xlookup() use.
* signal.c (sprintsigmask): Add const qualifier to first argument and return value.
* util.c (xlookup): Add const qualifier to return value.
(printxval): Update xlookup() use.

ChangeLog
defs.h
desc.c
process.c
signal.c
util.c

index 32dd59243e2ad679de2099e22be486b5e27f8d55..3cecbd0ea78ca563534067e29b0200339c40f207 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-12-27  Dmitry V. Levin <ldv@altlinux.org>
+
+       Add const qualifier to xlookup() return value
+
+       * defs.h (xlookup): Add const qualifier to return value.
+       * desc.c (sprintflags): Likewise.
+       * process.c (printpriv): Update xlookup() use.
+       * signal.c (sprintsigmask): Add const qualifier to first argument and return value.
+       * util.c (xlookup): Add const qualifier to return value.
+       (printxval): Update xlookup() use.
+
 2006-12-21  Dmitry V. Levin <ldv@altlinux.org>
 
        Move counts code to separate file.
diff --git a/defs.h b/defs.h
index beef2a77a165f28be2bb353955f465380802ddb5..8d893850d3151fcb7356246dbace241383ca519b 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -424,7 +424,7 @@ extern struct tcb *tcp_last;
 enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
 
 extern int set_personality P((int personality));
-extern char *xlookup P((const struct xlat *, int));
+extern const char *xlookup P((const struct xlat *, int));
 extern struct tcb *alloc_tcb P((int, int));
 extern struct tcb *pid2tcb P((int));
 extern void droptcb P((struct tcb *));
diff --git a/desc.c b/desc.c
index 6e534daeb36c888d53381c8c78ae77ac4be0e82a..29f8a95e3afe631dcc0c02e0f20c9d314f4f0af6 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -242,13 +242,11 @@ int getlk;
 }
 #endif
 
-static char *
-sprintflags(xlat, flags)
-const struct xlat *xlat;
-int flags;
+static const char *
+sprintflags(const struct xlat *xlat, int flags)
 {
        static char outstr[1024];
-       char *sep;
+       const char *sep;
 
        strcpy(outstr, "flags ");
        sep = "";
index 8e25640d99036b6b80c70f541e6a98b6cbf58fbd..d478293f72157886422cae1be2d7f82a6e52b4ce 100644 (file)
--- a/process.c
+++ b/process.c
@@ -1596,11 +1596,7 @@ static const struct xlat procpriv_type [] = {
 
 
 static void
-printpriv(tcp, addr, len, opt)
-struct tcb *tcp;
-long addr;
-int len;
-const struct xlat *opt;
+printpriv(struct tcb *tcp, long addr, int len, const struct xlat *opt)
 {
        priv_t buf [128];
        int max = verbose (tcp) ? sizeof buf / sizeof buf [0] : 10;
@@ -1619,7 +1615,7 @@ const struct xlat *opt;
        tprintf ("[");
 
        for (i = 0; i < len; ++i) {
-               char *t, *p;
+               const char *t, *p;
 
                if (i) tprintf (", ");
 
index 41f9ad4e364331169b7eb138fa133e7208812f76..d23727dd0ba6b0712b62596c0b84ca17f3916362 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -313,18 +313,16 @@ int len;
 #define copy_sigset(tcp, addr, s) copy_sigset_len(tcp, addr, s, sizeof(sigset_t))
 #endif
 
-static char *
-sprintsigmask(s, mask, rt)
-char *s;
-sigset_t *mask;
-int rt; /* set might include realtime sigs */
+static const char *
+sprintsigmask(const char *str, sigset_t *mask, int rt)
+/* set might include realtime sigs */
 {
        int i, nsigs;
        int maxsigs;
-       char *format;
+       char *format, *s;
        static char outstr[8 * sizeof(sigset_t) * 8];
 
-       strcpy(outstr, s);
+       strcpy(outstr, str);
        s = outstr + strlen(outstr);
        nsigs = 0;
        maxsigs = nsignals;
diff --git a/util.c b/util.c
index 470cec73b225fcca2545dcc764087a3fb99b7999..06162f4121238be74e034518e111d812a78cd08b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -231,10 +231,8 @@ int n;
        tv->tv_usec %= 1000000;
 }
 
-char *
-xlookup(xlat, val)
-const struct xlat *xlat;
-int val;
+const char *
+xlookup(const struct xlat *xlat, int val)
 {
        for (; xlat->str != NULL; xlat++)
                if (xlat->val == val)
@@ -246,12 +244,9 @@ int val;
  * Print entry in struct xlat table, if there.
  */
 void
-printxval(xlat, val, dflt)
-const struct xlat *xlat;
-int val;
-const char *dflt;
+printxval(const struct xlat *xlat, int val, const char *dflt)
 {
-       char *str = xlookup(xlat, val);
+       const char *str = xlookup(xlat, val);
 
        if (str)
                tprintf("%s", str);