]> git.openstreetmap.org Git - nominatim.git/blobdiff - module/nominatim.c
add function for parallel execution of SQL scripts
[nominatim.git] / module / nominatim.c
index a0d8c5aeb33d2fbf628d3eab1c0072ece4f59158..9d43c22f28e89da594ad20e39d9947dff2da7e23 100644 (file)
@@ -1,3 +1,11 @@
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
 #include "postgres.h"
 #include "fmgr.h"
 #include "mb/pg_wchar.h"
@@ -168,7 +176,7 @@ void str_replace(char* buffer, int* len, int* changes, char* from, int fromlen,
         p = strstr(buffer, from);
         while(p)
         {
-                if (!isspace || p == buffer || *(p-1) != ' ')
+                if (!isspace || (p > buffer && *(p-1) != ' '))
                 {
                         (*changes)++;
                         if (tolen != fromlen) memmove(p+tolen, p+fromlen, *len-(p-buffer)+1);