/[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 815 by zherczeg, Wed Dec 14 11:18:01 2011 UTC revision 816 by zherczeg, Wed Dec 21 23:08:51 2011 UTC
# Line 78  int entrysize; Line 78  int entrysize;
78  int top, bot;  int top, bot;
79  pcre_uchar *nametable;  pcre_uchar *nametable;
80    
81    #ifdef COMPILE_PCRE8
82  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
83    return rc;    return rc;
84  if (top <= 0) return PCRE_ERROR_NOSUBSTRING;  if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
# Line 86  if ((rc = pcre_fullinfo(code, NULL, PCRE Line 87  if ((rc = pcre_fullinfo(code, NULL, PCRE
87    return rc;    return rc;
88  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
89    return rc;    return rc;
90    #endif
91    #ifdef COMPILE_PCRE16
92    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
93      return rc;
94    if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
95    
96    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
97      return rc;
98    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
99      return rc;
100    #endif
101    
102  bot = 0;  bot = 0;
103  while (top > bot)  while (top > bot)
# Line 94  while (top > bot) Line 106  while (top > bot)
106    pcre_uchar *entry = nametable + entrysize*mid;    pcre_uchar *entry = nametable + entrysize*mid;
107    int c = STRCMP_UC_UC((pcre_uchar *)stringname,    int c = STRCMP_UC_UC((pcre_uchar *)stringname,
108      (pcre_uchar *)(entry + IMM2_SIZE));      (pcre_uchar *)(entry + IMM2_SIZE));
109    if (c == 0) return (entry[0] << 8) + entry[1];    if (c == 0) return GET2(entry, 0);
110    if (c > 0) bot = mid + 1; else top = mid;    if (c > 0) bot = mid + 1; else top = mid;
111    }    }
112    
# Line 135  int entrysize; Line 147  int entrysize;
147  int top, bot;  int top, bot;
148  pcre_uchar *nametable, *lastentry;  pcre_uchar *nametable, *lastentry;
149    
150    #ifdef COMPILE_PCRE8
151  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
152    return rc;    return rc;
153  if (top <= 0) return PCRE_ERROR_NOSUBSTRING;  if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
# Line 143  if ((rc = pcre_fullinfo(code, NULL, PCRE Line 156  if ((rc = pcre_fullinfo(code, NULL, PCRE
156    return rc;    return rc;
157  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)  if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
158    return rc;    return rc;
159    #endif
160    #ifdef COMPILE_PCRE16
161    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
162      return rc;
163    if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
164    
165    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
166      return rc;
167    if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
168      return rc;
169    #endif
170    
171  lastentry = nametable + entrysize * (top - 1);  lastentry = nametable + entrysize * (top - 1);
172  bot = 0;  bot = 0;
# Line 228  entrysize = pcre16_get_stringtable_entri Line 252  entrysize = pcre16_get_stringtable_entri
252  if (entrysize <= 0) return entrysize;  if (entrysize <= 0) return entrysize;
253  for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize)  for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize)
254    {    {
255    int n = (entry[0] << 8) + entry[1];    int n = GET2(entry, 0);
256    if (ovector[n*2] >= 0) return n;    if (ovector[n*2] >= 0) return n;
257    }    }
258  return (first[0] << 8) + first[1];  return GET2(entry, 0);
259  }  }
260    
261    

Legend:
Removed from v.815  
changed lines
  Added in v.816

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12