[postgis-tickets] r16674 - Use user provided CFLAGS in the address standardizer

Raul raul at rmr.ninja
Mon Jul 30 09:29:43 PDT 2018


Author: algunenano
Date: 2018-07-30 09:29:42 -0700 (Mon, 30 Jul 2018)
New Revision: 16674

Modified:
   trunk/NEWS
   trunk/extensions/address_standardizer/Makefile.in
   trunk/extensions/address_standardizer/parseaddress-api.c
Log:
Use user provided CFLAGS in the address standardizer

Closes https://github.com/postgis/postgis/pull/280
Closes #4140


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-07-30 16:26:39 UTC (rev 16673)
+++ trunk/NEWS	2018-07-30 16:29:42 UTC (rev 16674)
@@ -8,7 +8,8 @@
     (Vinícius A.B. Schmidt, Darafei Praliaskouski)
   - #4109, Fix WKT parser accepting and interpreting numbers numbers with
     multiple dots (Raúl Marín, Paul Ramsey)
-  - #4140, Use user-provided CFLAGS in the topology module (Raúl Marín)
+  - #4140, Use user-provided CFLAGS in address standardizer and the
+    topology module (Raúl Marín)
 
   See PostGIS 2.5.0 section for full details
 

Modified: trunk/extensions/address_standardizer/Makefile.in
===================================================================
--- trunk/extensions/address_standardizer/Makefile.in	2018-07-30 16:26:39 UTC (rev 16673)
+++ trunk/extensions/address_standardizer/Makefile.in	2018-07-30 16:29:42 UTC (rev 16674)
@@ -51,7 +51,7 @@
 
 
 DOCS = README.address_standardizer
-PG_CPPFLAGS = @CPPFLAGS@ -g -O0
+PG_CPPFLAGS = @CFLAGS@ @CPPFLAGS@
 
 SHLIB_LINK = @SHLIB_LINK@ -lpcre
 EXTRA_CLEAN = usps-st-city-name.txt mk-st-regexp mk-city-regex test_main

Modified: trunk/extensions/address_standardizer/parseaddress-api.c
===================================================================
--- trunk/extensions/address_standardizer/parseaddress-api.c	2018-07-30 16:26:39 UTC (rev 16673)
+++ trunk/extensions/address_standardizer/parseaddress-api.c	2018-07-30 16:29:42 UTC (rev 16674)
@@ -57,7 +57,7 @@
 
 int clean_trailing_punct(char *s)
 {
-    int i;
+    size_t i;
     int ret = 0;
 
     i=strlen(s)-1;
@@ -70,7 +70,7 @@
 
 char *clean_leading_punct(char *s)
 {
-    int i;
+    size_t i;
 
     for (i=0; i<strlen(s); i++)
         if (!(ispunct(s[i]) || isspace(s[i])))
@@ -81,7 +81,7 @@
 
 void strtoupper(char *s)
 {
-    int i;
+    size_t i;
 
     for (i=0; i<strlen(s); i++)
         s[i] = toupper(s[i]);
@@ -120,7 +120,7 @@
     char *state = NULL;
     char *regx;
     int mi;
-    int i, j;
+    size_t ui, uj;
     int rc;
     int comma = 0;
     ADDRESS *ret;
@@ -145,16 +145,16 @@
 
     /* clean the string of multiple white spaces and . */
 
-    for (i=0, j=0; i<strlen(s); i++) {
-        c = s[i];
-        if (c == '.') c = s[i] = ' ';
-        if (j == 0 && isspace(c)) continue;
-        if (i && isspace(c) && isspace(s[i-1])) continue;
-        s[j] = s[i];
-        j++;
+    for (ui=0, uj=0; ui<strlen(s); ui++) {
+        c = s[ui];
+        if (c == '.') c = s[ui] = ' ';
+        if (uj == 0 && isspace(c)) continue;
+        if (ui && isspace(c) && isspace(s[ui-1])) continue;
+        s[uj] = s[ui];
+        uj++;
     }
-    if (isspace(s[j-1])) j--;
-    s[j] = '\0';
+    if (isspace(s[uj-1])) uj--;
+    s[uj] = '\0';
 
     /* clean trailing punctuation */
     comma |= clean_trailing_punct(s);
@@ -299,6 +299,7 @@
     }
     DBG("Checked for state-city: %d", rc);
     if (rc <= 0) {
+        int i;
         /* run through the regx's and see if we get a match */
         for (i=0; i<nreg; i++) {
             mi++;



More information about the postgis-tickets mailing list