@@ -289,19 +289,19 @@ getTypes(int *numTypes)
289
289
i_typbyval = PQfnumberGroup (pbuf ,0 ,"typbyval" );
290
290
291
291
for (i = 0 ;i < ntups ;i ++ ) {
292
- tinfo [i ].oid = dupstr (PQgetvalue (pbuf ,i ,i_oid ));
293
- tinfo [i ].typowner = dupstr (PQgetvalue (pbuf ,i ,i_typowner ));
294
- tinfo [i ].typname = dupstr (PQgetvalue (pbuf ,i ,i_typname ));
295
- tinfo [i ].typlen = dupstr (PQgetvalue (pbuf ,i ,i_typlen ));
296
- tinfo [i ].typprtlen = dupstr (PQgetvalue (pbuf ,i ,i_typprtlen ));
297
- tinfo [i ].typinput = dupstr (PQgetvalue (pbuf ,i ,i_typinput ));
298
- tinfo [i ].typoutput = dupstr (PQgetvalue (pbuf ,i ,i_typoutput ));
299
- tinfo [i ].typreceive = dupstr (PQgetvalue (pbuf ,i ,i_typreceive ));
300
- tinfo [i ].typsend = dupstr (PQgetvalue (pbuf ,i ,i_typsend ));
301
- tinfo [i ].typelem = dupstr (PQgetvalue (pbuf ,i ,i_typelem ));
302
- tinfo [i ].typdelim = dupstr (PQgetvalue (pbuf ,i ,i_typdelim ));
303
- tinfo [i ].typdefault = dupstr (PQgetvalue (pbuf ,i ,i_typdefault ));
304
- tinfo [i ].typrelid = dupstr (PQgetvalue (pbuf ,i ,i_typrelid ));
292
+ tinfo [i ].oid = strdup (PQgetvalue (pbuf ,i ,i_oid ));
293
+ tinfo [i ].typowner = strdup (PQgetvalue (pbuf ,i ,i_typowner ));
294
+ tinfo [i ].typname = strdup (PQgetvalue (pbuf ,i ,i_typname ));
295
+ tinfo [i ].typlen = strdup (PQgetvalue (pbuf ,i ,i_typlen ));
296
+ tinfo [i ].typprtlen = strdup (PQgetvalue (pbuf ,i ,i_typprtlen ));
297
+ tinfo [i ].typinput = strdup (PQgetvalue (pbuf ,i ,i_typinput ));
298
+ tinfo [i ].typoutput = strdup (PQgetvalue (pbuf ,i ,i_typoutput ));
299
+ tinfo [i ].typreceive = strdup (PQgetvalue (pbuf ,i ,i_typreceive ));
300
+ tinfo [i ].typsend = strdup (PQgetvalue (pbuf ,i ,i_typsend ));
301
+ tinfo [i ].typelem = strdup (PQgetvalue (pbuf ,i ,i_typelem ));
302
+ tinfo [i ].typdelim = strdup (PQgetvalue (pbuf ,i ,i_typdelim ));
303
+ tinfo [i ].typdefault = strdup (PQgetvalue (pbuf ,i ,i_typdefault ));
304
+ tinfo [i ].typrelid = strdup (PQgetvalue (pbuf ,i ,i_typrelid ));
305
305
306
306
if (strcmp (PQgetvalue (pbuf ,i ,i_typbyval ), "f" ) == 0 )
307
307
tinfo [i ].passedbyvalue = 0 ;
@@ -390,19 +390,19 @@ getOperators(int *numOprs)
390
390
i_oprrsortop = PQfnumberGroup (pbuf ,0 ,"oprrsortop" );
391
391
392
392
for (i = 0 ;i < ntups ;i ++ ) {
393
- oprinfo [i ].oid = dupstr (PQgetvalue (pbuf ,i ,i_oid ));
394
- oprinfo [i ].oprname = dupstr (PQgetvalue (pbuf ,i ,i_oprname ));
395
- oprinfo [i ].oprkind = dupstr (PQgetvalue (pbuf ,i ,i_oprkind ));
396
- oprinfo [i ].oprcode = dupstr (PQgetvalue (pbuf ,i ,i_oprcode ));
397
- oprinfo [i ].oprleft = dupstr (PQgetvalue (pbuf ,i ,i_oprleft ));
398
- oprinfo [i ].oprright = dupstr (PQgetvalue (pbuf ,i ,i_oprright ));
399
- oprinfo [i ].oprcom = dupstr (PQgetvalue (pbuf ,i ,i_oprcom ));
400
- oprinfo [i ].oprnegate = dupstr (PQgetvalue (pbuf ,i ,i_oprnegate ));
401
- oprinfo [i ].oprrest = dupstr (PQgetvalue (pbuf ,i ,i_oprrest ));
402
- oprinfo [i ].oprjoin = dupstr (PQgetvalue (pbuf ,i ,i_oprjoin ));
403
- oprinfo [i ].oprcanhash = dupstr (PQgetvalue (pbuf ,i ,i_oprcanhash ));
404
- oprinfo [i ].oprlsortop = dupstr (PQgetvalue (pbuf ,i ,i_oprlsortop ));
405
- oprinfo [i ].oprrsortop = dupstr (PQgetvalue (pbuf ,i ,i_oprrsortop ));
393
+ oprinfo [i ].oid = strdup (PQgetvalue (pbuf ,i ,i_oid ));
394
+ oprinfo [i ].oprname = strdup (PQgetvalue (pbuf ,i ,i_oprname ));
395
+ oprinfo [i ].oprkind = strdup (PQgetvalue (pbuf ,i ,i_oprkind ));
396
+ oprinfo [i ].oprcode = strdup (PQgetvalue (pbuf ,i ,i_oprcode ));
397
+ oprinfo [i ].oprleft = strdup (PQgetvalue (pbuf ,i ,i_oprleft ));
398
+ oprinfo [i ].oprright = strdup (PQgetvalue (pbuf ,i ,i_oprright ));
399
+ oprinfo [i ].oprcom = strdup (PQgetvalue (pbuf ,i ,i_oprcom ));
400
+ oprinfo [i ].oprnegate = strdup (PQgetvalue (pbuf ,i ,i_oprnegate ));
401
+ oprinfo [i ].oprrest = strdup (PQgetvalue (pbuf ,i ,i_oprrest ));
402
+ oprinfo [i ].oprjoin = strdup (PQgetvalue (pbuf ,i ,i_oprjoin ));
403
+ oprinfo [i ].oprcanhash = strdup (PQgetvalue (pbuf ,i ,i_oprcanhash ));
404
+ oprinfo [i ].oprlsortop = strdup (PQgetvalue (pbuf ,i ,i_oprlsortop ));
405
+ oprinfo [i ].oprrsortop = strdup (PQgetvalue (pbuf ,i ,i_oprrsortop ));
406
406
}
407
407
408
408
PQclear (res + 1 );
@@ -471,16 +471,16 @@ getAggregates(int *numAggs)
471
471
i_agginitval2 = PQfnumberGroup (pbuf ,0 ,"agginitval2" );
472
472
473
473
for (i = 0 ;i < ntups ;i ++ ) {
474
- agginfo [i ].oid = dupstr (PQgetvalue (pbuf ,i ,i_oid ));
475
- agginfo [i ].aggname = dupstr (PQgetvalue (pbuf ,i ,i_aggname ));
476
- agginfo [i ].aggtransfn1 = dupstr (PQgetvalue (pbuf ,i ,i_aggtransfn1 ));
477
- agginfo [i ].aggtransfn2 = dupstr (PQgetvalue (pbuf ,i ,i_aggtransfn2 ));
478
- agginfo [i ].aggfinalfn = dupstr (PQgetvalue (pbuf ,i ,i_aggfinalfn ));
479
- agginfo [i ].aggtranstype1 = dupstr (PQgetvalue (pbuf ,i ,i_aggtranstype1 ));
480
- agginfo [i ].aggbasetype = dupstr (PQgetvalue (pbuf ,i ,i_aggbasetype ));
481
- agginfo [i ].aggtranstype2 = dupstr (PQgetvalue (pbuf ,i ,i_aggtranstype2 ));
482
- agginfo [i ].agginitval1 = dupstr (PQgetvalue (pbuf ,i ,i_agginitval1 ));
483
- agginfo [i ].agginitval2 = dupstr (PQgetvalue (pbuf ,i ,i_agginitval2 ));
474
+ agginfo [i ].oid = strdup (PQgetvalue (pbuf ,i ,i_oid ));
475
+ agginfo [i ].aggname = strdup (PQgetvalue (pbuf ,i ,i_aggname ));
476
+ agginfo [i ].aggtransfn1 = strdup (PQgetvalue (pbuf ,i ,i_aggtransfn1 ));
477
+ agginfo [i ].aggtransfn2 = strdup (PQgetvalue (pbuf ,i ,i_aggtransfn2 ));
478
+ agginfo [i ].aggfinalfn = strdup (PQgetvalue (pbuf ,i ,i_aggfinalfn ));
479
+ agginfo [i ].aggtranstype1 = strdup (PQgetvalue (pbuf ,i ,i_aggtranstype1 ));
480
+ agginfo [i ].aggbasetype = strdup (PQgetvalue (pbuf ,i ,i_aggbasetype ));
481
+ agginfo [i ].aggtranstype2 = strdup (PQgetvalue (pbuf ,i ,i_aggtranstype2 ));
482
+ agginfo [i ].agginitval1 = strdup (PQgetvalue (pbuf ,i ,i_agginitval1 ));
483
+ agginfo [i ].agginitval2 = strdup (PQgetvalue (pbuf ,i ,i_agginitval2 ));
484
484
}
485
485
486
486
PQclear (res + 1 );
@@ -553,14 +553,14 @@ getFuncs(int *numFuncs)
553
553
i_probin = PQfnumberGroup (pbuf ,0 ,"probin" );
554
554
555
555
for (i = 0 ;i < ntups ;i ++ ) {
556
- finfo [i ].oid = dupstr (PQgetvalue (pbuf ,i ,i_oid ));
557
- finfo [i ].proname = dupstr (PQgetvalue (pbuf ,i ,i_proname ));
558
- finfo [i ].proowner = dupstr (PQgetvalue (pbuf ,i ,i_proowner ));
556
+ finfo [i ].oid = strdup (PQgetvalue (pbuf ,i ,i_oid ));
557
+ finfo [i ].proname = strdup (PQgetvalue (pbuf ,i ,i_proname ));
558
+ finfo [i ].proowner = strdup (PQgetvalue (pbuf ,i ,i_proowner ));
559
559
560
560
finfo [i ].prosrc = checkForQuote (PQgetvalue (pbuf ,i ,i_prosrc ));
561
- finfo [i ].probin = dupstr (PQgetvalue (pbuf ,i ,i_probin ));
561
+ finfo [i ].probin = strdup (PQgetvalue (pbuf ,i ,i_probin ));
562
562
563
- finfo [i ].prorettype = dupstr (PQgetvalue (pbuf ,i ,i_prorettype ));
563
+ finfo [i ].prorettype = strdup (PQgetvalue (pbuf ,i ,i_prorettype ));
564
564
finfo [i ].retset = (strcmp (PQgetvalue (pbuf ,i ,i_proretset ),"t" ) == 0 );
565
565
finfo [i ].nargs = atoi (PQgetvalue (pbuf ,i ,i_pronargs ));
566
566
finfo [i ].lang = (atoi (PQgetvalue (pbuf ,i ,i_prolang )) == C_PROLANG_OID );
@@ -624,9 +624,9 @@ getTables(int *numTables)
624
624
i_relarch = PQfnumberGroup (pbuf ,0 ,"relarch" );
625
625
626
626
for (i = 0 ;i < ntups ;i ++ ) {
627
- tblinfo [i ].oid = dupstr (PQgetvalue (pbuf ,i ,i_oid ));
628
- tblinfo [i ].relname = dupstr (PQgetvalue (pbuf ,i ,i_relname ));
629
- tblinfo [i ].relarch = dupstr (PQgetvalue (pbuf ,i ,i_relarch ));
627
+ tblinfo [i ].oid = strdup (PQgetvalue (pbuf ,i ,i_oid ));
628
+ tblinfo [i ].relname = strdup (PQgetvalue (pbuf ,i ,i_relname ));
629
+ tblinfo [i ].relarch = strdup (PQgetvalue (pbuf ,i ,i_relarch ));
630
630
}
631
631
632
632
PQclear (res + 1 );
@@ -677,8 +677,8 @@ getInherits(int *numInherits)
677
677
i_inhparent = PQfnumberGroup (pbuf ,0 ,"inhparent" );
678
678
679
679
for (i = 0 ;i < ntups ;i ++ ) {
680
- inhinfo [i ].inhrel = dupstr (PQgetvalue (pbuf ,i ,i_inhrel ));
681
- inhinfo [i ].inhparent = dupstr (PQgetvalue (pbuf ,i ,i_inhparent ));
680
+ inhinfo [i ].inhrel = strdup (PQgetvalue (pbuf ,i ,i_inhrel ));
681
+ inhinfo [i ].inhparent = strdup (PQgetvalue (pbuf ,i ,i_inhparent ));
682
682
}
683
683
684
684
PQclear (res + 1 );
@@ -740,8 +740,8 @@ if (g_verbose)
740
740
tblinfo [i ].parentRels = NULL ;
741
741
tblinfo [i ].numParents = 0 ;
742
742
for (j = 0 ;j < ntups ;j ++ ) {
743
- tblinfo [i ].attnames [j ] = dupstr (PQgetvalue (pbuf ,j ,i_attname ));
744
- tblinfo [i ].typnames [j ] = dupstr (PQgetvalue (pbuf ,j ,i_typname ));
743
+ tblinfo [i ].attnames [j ] = strdup (PQgetvalue (pbuf ,j ,i_attname ));
744
+ tblinfo [i ].typnames [j ] = strdup (PQgetvalue (pbuf ,j ,i_typname ));
745
745
tblinfo [i ].inhAttrs [j ] = 0 ; /* this flag is set in flagInhAttrs()*/
746
746
}
747
747
PQclear (res + 1 );
@@ -809,12 +809,12 @@ getIndices(int *numIndices)
809
809
i_indclassname = PQfnumberGroup (pbuf ,0 ,"indclassname" );
810
810
811
811
for (i = 0 ;i < ntups ;i ++ ) {
812
- indinfo [i ].indexrelname = dupstr (PQgetvalue (pbuf ,i ,i_indexrelname ));
813
- indinfo [i ].indrelname = dupstr (PQgetvalue (pbuf ,i ,i_indrelname ));
814
- indinfo [i ].indamname = dupstr (PQgetvalue (pbuf ,i ,i_indamname ));
815
- indinfo [i ].indproc = dupstr (PQgetvalue (pbuf ,i ,i_indproc ));
816
- indinfo [i ].indkey = dupstr (PQgetvalue (pbuf ,i ,i_indkey ));
817
- indinfo [i ].indclassname = dupstr (PQgetvalue (pbuf ,i ,i_indclassname ));
812
+ indinfo [i ].indexrelname = strdup (PQgetvalue (pbuf ,i ,i_indexrelname ));
813
+ indinfo [i ].indrelname = strdup (PQgetvalue (pbuf ,i ,i_indrelname ));
814
+ indinfo [i ].indamname = strdup (PQgetvalue (pbuf ,i ,i_indamname ));
815
+ indinfo [i ].indproc = strdup (PQgetvalue (pbuf ,i ,i_indproc ));
816
+ indinfo [i ].indkey = strdup (PQgetvalue (pbuf ,i ,i_indkey ));
817
+ indinfo [i ].indclassname = strdup (PQgetvalue (pbuf ,i ,i_indclassname ));
818
818
}
819
819
PQclear (res + 1 );
820
820
PQexec ("end" );
@@ -1368,7 +1368,7 @@ dumpIndices(FILE* fout, IndInfo* indinfo, int numIndices,
1368
1368
indinfo [i ].indproc );
1369
1369
res = PQexec (q );
1370
1370
pbuf = PQparray (res + 1 );
1371
- funcname = dupstr (PQgetvalue (pbuf ,0 ,
1371
+ funcname = strdup (PQgetvalue (pbuf ,0 ,
1372
1372
PQfnumberGroup (pbuf ,0 ,"proname" )));
1373
1373
PQclear (res + 1 );
1374
1374
}
@@ -1594,7 +1594,7 @@ checkForQuote(char* s)
1594
1594
}
1595
1595
r [j ] = '\0' ;
1596
1596
1597
- result = dupstr (r );
1597
+ result = strdup (r );
1598
1598
free (r );
1599
1599
1600
1600
return result ;
0 commit comments