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

Function cache_tag

extern/btyacc/reader.c:685–706  ·  view source on GitHub ↗

Date: Mon, 29 Jun 1998 16:36:47 +0200 From: Matthias Meixner Organization: TH Darmstadt, Mikroelektronische Systeme While using your version of BTYacc (V2.1), I have found a bug. It does not correctly handle typenames, if one typename is a prefix of another one and if this type is used after the longer one. In this case BTYacc produces invalid code. e.g. in: -------

Source from the content-addressed store, hash-verified

683// b: A {$$=$1;}
684//
685static char *cache_tag(char *tag, int len)
686{
687int i;
688char *s;
689
690 for (i = 0; i < ntags; ++i) {
691 if (strncmp(tag, tag_table[i], len) == 0 &&
692 // VM: this is bug fix proposed by Matthias Meixner
693 tag_table[i][len]==0)
694 return (tag_table[i]); }
695 if (ntags >= tagmax) {
696 tagmax += 16;
697 tag_table = tag_table ? RENEW(tag_table, tagmax, char *)
698 : NEW2(tagmax, char *);
699 if (tag_table == 0) no_space(); }
700 s = MALLOC(len + 1);
701 if (s == 0) no_space();
702 strncpy(s, tag, len);
703 s[len] = 0;
704 tag_table[ntags++] = s;
705 return s;
706}
707
708char *get_tag()
709{

Callers 3

get_tagFunction · 0.85
scan_idFunction · 0.85
parse_idFunction · 0.85

Calls 1

no_spaceFunction · 0.85

Tested by

no test coverage detected