1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Add resetStringInfo(), which clears the content of a StringInfo, and

fixup various places in the tree that were clearing a StringInfo by hand.
Making this function a part of the API simplifies client code slightly,
and avoids needlessly peeking inside the StringInfo interface.
This commit is contained in:
Neil Conway
2007-03-03 19:32:55 +00:00
parent 053981f405
commit 90d76525c5
11 changed files with 57 additions and 69 deletions

View File

@ -1378,15 +1378,12 @@ build_tuplestore_recursively(char *key_fld,
"incompatible.")));
}
initStringInfo(&branchstr);
initStringInfo(&chk_branchstr);
initStringInfo(&chk_current_key);
for (i = 0; i < proc; i++)
{
/* start a new branch */
initStringInfo(&branchstr);
/* need these to check for recursion */
initStringInfo(&chk_branchstr);
initStringInfo(&chk_current_key);
/* initialize branch for this pass */
appendStringInfo(&branchstr, "%s", branch);
appendStringInfo(&chk_branchstr, "%s%s%s", branch_delim, branch, branch_delim);
@ -1459,10 +1456,14 @@ build_tuplestore_recursively(char *key_fld,
tupstore);
/* reset branch for next pass */
xpfree(branchstr.data);
xpfree(chk_branchstr.data);
xpfree(chk_current_key.data);
resetStringInfo(&branchstr);
resetStringInfo(&chk_branchstr);
resetStringInfo(&chk_current_key);
}
xpfree(branchstr.data);
xpfree(chk_branchstr.data);
xpfree(chk_current_key.data);
}
return tupstore;