6 |
and semantics are as close as possible to those of the Perl 5 language. |
and semantics are as close as possible to those of the Perl 5 language. |
7 |
|
|
8 |
Written by Philip Hazel |
Written by Philip Hazel |
9 |
Copyright (c) 1997-2008 University of Cambridge |
Copyright (c) 1997-2012 University of Cambridge |
10 |
|
|
11 |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
12 |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
68 |
a negative error number |
a negative error number |
69 |
*/ |
*/ |
70 |
|
|
71 |
|
#ifdef COMPILE_PCRE8 |
72 |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
73 |
pcre_refcount(pcre *argument_re, int adjust) |
pcre_refcount(pcre *argument_re, int adjust) |
74 |
|
#else |
75 |
|
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION |
76 |
|
pcre_refcount(pcre *argument_re, int adjust) |
77 |
|
#endif |
78 |
{ |
{ |
79 |
real_pcre *re = (real_pcre *)argument_re; |
real_pcre *re = (real_pcre *)argument_re; |
80 |
if (re == NULL) return PCRE_ERROR_NULL; |
if (re == NULL) return PCRE_ERROR_NULL; |
81 |
|
if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; |
82 |
|
if ((re->flags & PCRE_MODE) == 0) return PCRE_ERROR_BADMODE; |
83 |
re->ref_count = (-adjust > re->ref_count)? 0 : |
re->ref_count = (-adjust > re->ref_count)? 0 : |
84 |
(adjust + re->ref_count > 65535)? 65535 : |
(adjust + re->ref_count > 65535)? 65535 : |
85 |
re->ref_count + adjust; |
re->ref_count + adjust; |