You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rainer Jung <ra...@kippdata.de> on 2017/10/16 12:29:01 UTC

gcc error (-Werror=pointer-compare) in trunk util_expr_eval.c

I get the following error for an old line (r1037504, but now trying 
maintainer-mode):

.../server/util_expr_eval.c: In function 'ap_expr_eval_re_backref':
.../server/util_expr_eval.c:265:63: error: comparison between pointer 
and zero character constant [-Werror=pointer-compare]
      if (!ctx->re_pmatch || !ctx->re_source || *ctx->re_source == '\0' ||
                                                                ^~
.../server/util_expr_eval.c:265:47: note: did you mean to dereference 
the pointer?
      if (!ctx->re_pmatch || !ctx->re_source || *ctx->re_source == '\0' ||
                                                ^

and indeed re_source is defined as

const char **re_source;

So does the following patch look good (one more level of dereferencing)?

Index: server/util_expr_eval.c
===================================================================
--- server/util_expr_eval.c     (revision 1812263)
+++ server/util_expr_eval.c     (working copy)
@@ -262,7 +262,7 @@
  {
      int len;

-    if (!ctx->re_pmatch || !ctx->re_source || *ctx->re_source == '\0' ||
+    if (!ctx->re_pmatch || !ctx->re_source || **ctx->re_source == '\0' ||
          ctx->re_nmatch < n + 1)
          return "";


The 2.4 branch looks the same as trunk.

Regards,

Rainer