[experimental-ims] 74f3c13 A quick style polish
Geoff Simmons
geoff at varnish-cache.org
Mon Jan 9 21:52:01 CET 2012
commit 74f3c13ec5b0a451480431cc1a7db58d56bb5b90
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Sep 22 11:41:39 2011 +0000
A quick style polish
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index e97758a..667d177 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -38,41 +38,47 @@ struct vre {
pcre *re;
};
-vre_t *VRE_compile(const char *pattern, int options,
- const char **errptr, int *erroffset) {
+vre_t *
+VRE_compile(const char *pattern, int options,
+ const char **errptr, int *erroffset)
+{
vre_t *v;
*errptr = NULL; *erroffset = 0;
ALLOC_OBJ(v, VRE_MAGIC);
- AN(v);
+ if (v == NULL)
+ return (NULL);
v->re = pcre_compile(pattern, options, errptr, erroffset, NULL);
if (v->re == NULL) {
VRE_free(&v);
- return NULL;
+ return (NULL);
}
- return v;
+ return (v);
}
-int VRE_exec(const vre_t *code, const char *subject, int length,
- int startoffset, int options, int *ovector, int ovecsize) {
+int
+VRE_exec(const vre_t *code, const char *subject, int length,
+ int startoffset, int options, int *ovector, int ovecsize)
+{
CHECK_OBJ_NOTNULL(code, VRE_MAGIC);
int ov[30];
+
if (ovector == NULL) {
ovector = ov;
ovecsize = sizeof(ov)/sizeof(ov[0]);
}
- return pcre_exec(code->re, NULL, subject, length,
- startoffset, options, ovector, ovecsize);
+ return (pcre_exec(code->re, NULL, subject, length,
+ startoffset, options, ovector, ovecsize));
}
-void VRE_free(vre_t **vv) {
-
+void
+VRE_free(vre_t **vv)
+{
vre_t *v = *vv;
*vv = NULL;
CHECK_OBJ(v, VRE_MAGIC);
pcre_free(v->re);
- v->magic = 0;
FREE_OBJ(v);
}
More information about the varnish-commit
mailing list