MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / copy_args

Function copy_args

extern/btyacc/reader.c:956–990  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954static int rescan_lineno;
955
956static char *copy_args(int *alen)
957{
958struct mstring *s = msnew();
959int depth = 0, len = 1, c;
960char quote = 0;
961int a_lineno = lineno;
962char *a_line = dup_line();
963char *a_cptr = a_line + (cptr - line - 1);
964
965 rescan_lineno = lineno;
966 while ((c = *cptr++) != ')' || depth || quote) {
967 if (c == ',' && !quote && !depth) {
968 len++;
969 mputc(s, 0);
970 continue; }
971 mputc(s, c);
972 if (c == '\n') {
973 get_line();
974 if (!line) {
975 if (quote)
976 unterminated_string(a_lineno, a_line, a_cptr);
977 else
978 unterminated_arglist(a_lineno, a_line, a_cptr); } }
979 else if (quote) {
980 if (c == quote) quote = 0;
981 else if (c == '\\') {
982 if (*cptr != '\n') mputc(s, *cptr++); } }
983 else {
984 if (c == '(') depth++;
985 else if (c == ')') depth--;
986 else if (c == '\"' || c == '\'') quote = c; } }
987 if (alen) *alen = len;
988 FREE(a_line);
989 return msdone(s);
990}
991
992static char *parse_id(char *p, char **save)
993{

Callers 2

advance_to_startFunction · 0.85
add_symbolFunction · 0.85

Calls 6

msnewFunction · 0.85
dup_lineFunction · 0.85
unterminated_stringFunction · 0.85
unterminated_arglistFunction · 0.85
msdoneFunction · 0.85
get_lineFunction · 0.70

Tested by

no test coverage detected