Remove duplicate variable initializations identified by clang static checker.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Aug 2009 16:53:31 +0000 (16:53 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Aug 2009 16:53:31 +0000 (16:53 +0000)
One of these represents a nontrivial bug (a promptly-leaked palloc), so
backpatch.

Greg Stark

src/backend/tsearch/regis.c
src/backend/tsearch/ts_parse.c
src/backend/utils/adt/encode.c

index 8980c2aec4333dc70a35c92abba4266ccdf4bd40..e492562a1e2b3f969182ec7fe7e9d662bcd15f17 100644 (file)
@@ -182,7 +182,7 @@ RS_free(Regis *r)
 static bool
 mb_strchr(char *str, char *c)
 {
-       int                     clen = pg_mblen(c),
+       int                     clen,
                                plen,
                                i;
        char       *ptr = str;
index f2440c43d0ec3a689a3bd8f93d99319a0a99bf8d..c07488ed5f92d4c5c9a373eb117507662b769adb 100644 (file)
@@ -101,7 +101,6 @@ LexizeAddLemm(LexizeData *ld, int type, char *lemm, int lenlemm)
 {
        ParsedLex  *newpl = (ParsedLex *) palloc(sizeof(ParsedLex));
 
-       newpl = (ParsedLex *) palloc(sizeof(ParsedLex));
        newpl->type = type;
        newpl->lemm = lemm;
        newpl->lenlemm = lenlemm;
index b2042e78b0d2e971973af9a183a7ab1c1e21dc14..1e144d952fb36d4e860e5dbe9d8bafb8ee3eb3b2 100644 (file)
@@ -159,7 +159,7 @@ hex_decode(const char *src, unsigned len, char *dst)
                           *srcend;
        char            v1,
                                v2,
-                          *p = dst;
+                          *p;
 
        srcend = src + len;
        s = src;