]> granicus.if.org Git - postgresql/commitdiff
Change logic slightly to avoid one unnecessary calculation. No big deal.
authorThomas G. Lockhart <lockhart@fourpalms.org>
Tue, 23 Dec 1997 19:24:43 +0000 (19:24 +0000)
committerThomas G. Lockhart <lockhart@fourpalms.org>
Tue, 23 Dec 1997 19:24:43 +0000 (19:24 +0000)
src/backend/utils/adt/varchar.c

index 325d5f6f415001f1d414a4588075c1b17d9d9d2e..f52f52d47bc3f769a86aa62c4f3d61e286a96264 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.13 1997/12/16 15:59:09 thomas Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.14 1997/12/23 19:24:43 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
  *       len is the length specified in () plus VARHDRSZ bytes. (XXX dummy is here
  *       because we pass typelem as the second argument for array_in.)
  */
-char      *
+char *
 bpcharin(char *s, int dummy, int typlen)
 {
        char       *result,
                           *r;
-       int                     len = typlen - VARHDRSZ;
+       int                     len;
        int                     i;
 
        if (s == NULL)
@@ -69,6 +69,10 @@ bpcharin(char *s, int dummy, int typlen)
                len = strlen(s);
                typlen = len + VARHDRSZ;
        }
+       else
+       {
+               len = typlen - VARHDRSZ;
+       }
 
        if (len > 4096)
                elog(WARN, "bpcharin: length of char() must be less than 4096");
@@ -90,7 +94,7 @@ bpcharin(char *s, int dummy, int typlen)
        return (result);
 }
 
-char      *
+char *
 bpcharout(char *s)
 {
        char       *result;
@@ -150,7 +154,7 @@ varcharin(char *s, int dummy, int typlen)
        return (result);
 }
 
-char      *
+char *
 varcharout(char *s)
 {
        char       *result;