| 1281 |
rc = set_start_bits(code, start_bits, (re->options & PCRE_UTF8) != 0, |
rc = set_start_bits(code, start_bits, (re->options & PCRE_UTF8) != 0, |
| 1282 |
&compile_block); |
&compile_block); |
| 1283 |
bits_set = rc == SSB_DONE; |
bits_set = rc == SSB_DONE; |
| 1284 |
if (rc == SSB_UNKNOWN) |
if (rc == SSB_UNKNOWN) |
| 1285 |
{ |
{ |
| 1286 |
*errorptr = "internal error: opcode not recognized"; |
*errorptr = "internal error: opcode not recognized"; |
| 1287 |
return NULL; |
return NULL; |
| 1288 |
} |
} |
| 1289 |
} |
} |
| 1290 |
|
|
| 1291 |
/* Find the minimum length of subject string. */ |
/* Find the minimum length of subject string. */ |
| 1306 |
so that if it becomes variable in the future, we don't have to change that |
so that if it becomes variable in the future, we don't have to change that |
| 1307 |
code. */ |
code. */ |
| 1308 |
|
|
| 1309 |
if (bits_set || min > 0 |
if (bits_set || min > 0 |
| 1310 |
#ifdef SUPPORT_JIT |
#ifdef SUPPORT_JIT |
| 1311 |
|| (options & PCRE_STUDY_JIT_COMPILE) != 0 |
|| (options & PCRE_STUDY_JIT_COMPILE) != 0 |
| 1312 |
#endif |
#endif |
| 1319 |
*errorptr = "failed to get memory"; |
*errorptr = "failed to get memory"; |
| 1320 |
return NULL; |
return NULL; |
| 1321 |
} |
} |
| 1322 |
|
|
| 1323 |
study = (pcre_study_data *)((char *)extra + sizeof(pcre_extra)); |
study = (pcre_study_data *)((char *)extra + sizeof(pcre_extra)); |
| 1324 |
extra->flags = PCRE_EXTRA_STUDY_DATA; |
extra->flags = PCRE_EXTRA_STUDY_DATA; |
| 1325 |
extra->study_data = study; |
extra->study_data = study; |
| 1326 |
|
|
| 1327 |
study->size = sizeof(pcre_study_data); |
study->size = sizeof(pcre_study_data); |
| 1328 |
study->flags = 0; |
study->flags = 0; |
| 1329 |
|
|
| 1330 |
if (bits_set) |
if (bits_set) |
| 1331 |
{ |
{ |
| 1332 |
study->flags |= PCRE_STUDY_MAPPED; |
study->flags |= PCRE_STUDY_MAPPED; |
| 1333 |
memcpy(study->start_bits, start_bits, sizeof(start_bits)); |
memcpy(study->start_bits, start_bits, sizeof(start_bits)); |
| 1334 |
} |
} |
| 1335 |
|
|
| 1336 |
/* Always set the minlength value in the block, because the JIT compiler |
/* Always set the minlength value in the block, because the JIT compiler |
| 1337 |
makes use of it. However, don't set the bit unless the length is greater than |
makes use of it. However, don't set the bit unless the length is greater than |
| 1338 |
zero - the interpretive pcre_exec() and pcre_dfa_exec() needn't waste time |
zero - the interpretive pcre_exec() and pcre_dfa_exec() needn't waste time |
| 1339 |
checking this case. */ |
checking this case. */ |
| 1340 |
|
|
| 1341 |
study->minlength = min; |
study->minlength = min; |
| 1342 |
if (min > 0) study->flags |= PCRE_STUDY_MINLEN; |
if (min > 0) study->flags |= PCRE_STUDY_MINLEN; |
| 1343 |
|
|
| 1344 |
/* If JIT support was compiled and requested, attempt the JIT compilation. |
/* If JIT support was compiled and requested, attempt the JIT compilation. |
| 1345 |
If no starting bytes were found, and the minimum length is zero, and JIT |
If no starting bytes were found, and the minimum length is zero, and JIT |
| 1346 |
compilation fails, abandon the extra block and return NULL. */ |
compilation fails, abandon the extra block and return NULL. */ |
| 1347 |
|
|
| 1348 |
#ifdef SUPPORT_JIT |
#ifdef SUPPORT_JIT |
| 1349 |
extra->executable_jit = NULL; |
extra->executable_jit = NULL; |
| 1350 |
if ((options & PCRE_STUDY_JIT_COMPILE) != 0) _pcre_jit_compile(re, extra); |
if ((options & PCRE_STUDY_JIT_COMPILE) != 0) _pcre_jit_compile(re, extra); |
| 1352 |
{ |
{ |
| 1353 |
pcre_free_study(extra); |
pcre_free_study(extra); |
| 1354 |
extra = NULL; |
extra = NULL; |
| 1355 |
} |
} |
| 1356 |
#endif |
#endif |
| 1357 |
} |
} |
| 1358 |
|
|
| 1374 |
pcre_free_study(pcre_extra *extra) |
pcre_free_study(pcre_extra *extra) |
| 1375 |
{ |
{ |
| 1376 |
#ifdef SUPPORT_JIT |
#ifdef SUPPORT_JIT |
| 1377 |
if ((extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 && |
if ((extra->flags & PCRE_EXTRA_EXECUTABLE_JIT) != 0 && |
| 1378 |
extra->executable_jit != NULL) |
extra->executable_jit != NULL) |
| 1379 |
_pcre_jit_free(extra->executable_jit); |
_pcre_jit_free(extra->executable_jit); |
| 1380 |
#endif |
#endif |