/[pcre]/code/branches/pcre16/pcre_get.c
ViewVC logotype

Diff of /code/branches/pcre16/pcre_get.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 755 by ph10, Mon Nov 21 10:41:54 2011 UTC revision 756 by ph10, Mon Nov 21 10:48:42 2011 UTC
# Line 71  pcre_get_stringnumber(const pcre *code, Line 71  pcre_get_stringnumber(const pcre *code,
71  int rc;  int rc;
72  int entrysize;  int entrysize;
73  int top, bot;  int top, bot;
74  uschar *nametable;  pcre_uchar *nametable;
75    
76  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
77    return rc;    return rc;
# Line 86  bot = 0; Line 86  bot = 0;
86  while (top > bot)  while (top > bot)
87    {    {
88    int mid = (top + bot) / 2;    int mid = (top + bot) / 2;
89    uschar *entry = nametable + entrysize*mid;    pcre_uchar *entry = nametable + entrysize*mid;
90    int c = strcmp(stringname, (char *)(entry + 2));    int c = strcmp(stringname, (char *)(entry + 2));
91    if (c == 0) return (entry[0] << 8) + entry[1];    if (c == 0) return (entry[0] << 8) + entry[1];
92    if (c > 0) bot = mid + 1; else top = mid;    if (c > 0) bot = mid + 1; else top = mid;
# Line 121  pcre_get_stringtable_entries(const pcre Line 121  pcre_get_stringtable_entries(const pcre
121  int rc;  int rc;
122  int entrysize;  int entrysize;
123  int top, bot;  int top, bot;
124  uschar *nametable, *lastentry;  pcre_uchar *nametable, *lastentry;
125    
126  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
127    return rc;    return rc;
# Line 137  bot = 0; Line 137  bot = 0;
137  while (top > bot)  while (top > bot)
138    {    {
139    int mid = (top + bot) / 2;    int mid = (top + bot) / 2;
140    uschar *entry = nametable + entrysize*mid;    pcre_uchar *entry = nametable + entrysize*mid;
141    int c = strcmp(stringname, (char *)(entry + 2));    int c = strcmp(stringname, (char *)(entry + 2));
142    if (c == 0)    if (c == 0)
143      {      {
144      uschar *first = entry;      pcre_uchar *first = entry;
145      uschar *last = entry;      pcre_uchar *last = entry;
146      while (first > nametable)      while (first > nametable)
147        {        {
148        if (strcmp(stringname, (char *)(first - entrysize + 2)) != 0) break;        if (strcmp(stringname, (char *)(first - entrysize + 2)) != 0) break;
# Line 188  get_first_set(const pcre *code, const ch Line 188  get_first_set(const pcre *code, const ch
188  const real_pcre *re = (const real_pcre *)code;  const real_pcre *re = (const real_pcre *)code;
189  int entrysize;  int entrysize;
190  char *first, *last;  char *first, *last;
191  uschar *entry;  pcre_uchar *entry;
192  if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)  if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
193    return pcre_get_stringnumber(code, stringname);    return pcre_get_stringnumber(code, stringname);
194  entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);  entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
195  if (entrysize <= 0) return entrysize;  if (entrysize <= 0) return entrysize;
196  for (entry = (uschar *)first; entry <= (uschar *)last; entry += entrysize)  for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize)
197    {    {
198    int n = (entry[0] << 8) + entry[1];    int n = (entry[0] << 8) + entry[1];
199    if (ovector[n*2] >= 0) return n;    if (ovector[n*2] >= 0) return n;

Legend:
Removed from v.755  
changed lines
  Added in v.756

  ViewVC Help
Powered by ViewVC 1.1.5