break;
case OVSDB_TYPE_STRING:
+#ifdef HAVE_PCRE
base->u.string.re = NULL;
+#endif
base->u.string.reMatch = NULL;
base->u.string.reComment = NULL;
base->u.string.minLen = 0;
break;
case OVSDB_TYPE_STRING:
+#if HAVE_PCRE
if (dst->u.string.re) {
pcre_refcount(dst->u.string.re, 1);
}
+#else
+ if (dst->u.string.reMatch) {
+ dst->u.string.reMatch = xstrdup(dst->u.string.reMatch);
+ }
+ if (dst->u.string.reComment) {
+ dst->u.string.reComment = xstrdup(dst->u.string.reComment);
+ }
+#endif
break;
+
case OVSDB_TYPE_UUID:
if (dst->u.uuid.refTableName) {
dst->u.uuid.refTableName = xstrdup(dst->u.uuid.refTableName);
break;
case OVSDB_TYPE_STRING:
+#ifdef HAVE_PCRE
if (base->u.string.re && !pcre_refcount(base->u.string.re, -1)) {
pcre_free(base->u.string.re);
free(base->u.string.reMatch);
free(base->u.string.reComment);
}
+#else
+ free(base->u.string.reMatch);
+ free(base->u.string.reComment);
+#endif
break;
case OVSDB_TYPE_UUID:
ovsdb_base_type_set_regex(struct ovsdb_base_type *base,
const char *reMatch, const char *reComment)
{
+#ifdef HAVE_PCRE
const char *errorString;
const char *pattern;
int errorOffset;
if (pattern[0] == '\0' || strchr(pattern, '\0')[-1] != '$') {
pattern = xasprintf("%s$", pattern);
}
+
+#ifndef PCRE_JAVASCRIPT_COMPAT /* Added in PCRE 7.7. */
+#define PCRE_JAVASCRIPT_COMPAT 0
+#endif
base->u.string.re = pcre_compile(pattern, (PCRE_ANCHORED | PCRE_UTF8
| PCRE_JAVASCRIPT_COMPAT),
&errorString, &errorOffset, NULL);
"\"%s\" is not a valid regular "
"expression: %s", reMatch, errorString);
}
+ pcre_refcount(base->u.string.re, 1);
+#endif
/* Save regular expression. */
- pcre_refcount(base->u.string.re, 1);
base->u.string.reMatch = xstrdup(reMatch);
base->u.string.reComment = reComment ? xstrdup(reComment) : NULL;
return NULL;