Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Applied patch by Chen Huajun <chenhj@cn.fujitsu.com> to make ecpg able to cope
authorMichael Meskes <meskes@postgresql.org>
Fri, 23 Nov 2012 13:39:27 +0000 (14:39 +0100)
committerMichael Meskes <meskes@postgresql.org>
Fri, 23 Nov 2012 13:39:27 +0000 (14:39 +0100)
with very long structs.

src/interfaces/ecpg/preproc/type.c

index c743616a6caa539533dbfcc4a97bf3a23ff34267..cf2ff158413c3d9be1a44f9d0c082ecfa2a202ca 100644 (file)
@@ -506,8 +506,8 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
     */
    struct ECPGstruct_member *p,
               *ind_p = NULL;
-   char        pbuf[BUFSIZ],
-               ind_pbuf[BUFSIZ];
+   char        *pbuf = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 3);
+   char        *ind_pbuf = (char *) mm_alloc(strlen(ind_name) + ((ind_prefix == NULL) ? 0 : strlen(ind_prefix)) + 3);
 
    if (atoi(arrsiz) == 1)
        sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
@@ -540,6 +540,9 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
        if (ind_p != NULL && ind_p != &struct_no_indicator)
            ind_p = ind_p->next;
    }
+
+   free(pbuf);
+   free(ind_pbuf);
 }
 
 void