[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-1026-gcc685dd11

git at osgeo.org git at osgeo.org
Tue Jun 27 19:39:00 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  cc685dd11fe739ea878f3ea5d8437e170dcafb0a (commit)
      from  56efbaf5e3051fc16032343bb8b1c316c8927ccc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cc685dd11fe739ea878f3ea5d8437e170dcafb0a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jun 27 19:38:48 2023 -0700

    Strip down field name prepending code to bare minimum

diff --git a/loader/shp2pgsql-core.c b/loader/shp2pgsql-core.c
index c2d192af9..2e9665a26 100644
--- a/loader/shp2pgsql-core.c
+++ b/loader/shp2pgsql-core.c
@@ -1163,21 +1163,19 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
 		 * or after pgsql reserved attribute names
 		 */
 		if (name[0] == '_' ||
-		        ! strcmp(name, "gid") ||
-		        ! strcmp(name, "tableoid") ||
-		        ! strcmp(name, "cmin") ||
-		        ! strcmp(name, "cmax") ||
-		        ! strcmp(name, "xmin") ||
-		        ! strcmp(name, "xmax") ||
-		        ! strcmp(name, "primary") ||
-		        ! strcmp(name, "oid") ||
-		        ! strcmp(name, "ctid"))
+		    ! strcmp(name, "gid") ||
+		    ! strcmp(name, "tableoid") ||
+		    ! strcmp(name, "cmin") ||
+		    ! strcmp(name, "cmax") ||
+		    ! strcmp(name, "xmin") ||
+		    ! strcmp(name, "xmax") ||
+		    ! strcmp(name, "primary") ||
+		    ! strcmp(name, "oid") ||
+		    ! strcmp(name, "ctid"))
 		{
-			char tmp_name[MAXFIELDNAMELEN];
-			strncpy(tmp_name + 2, name, MAXFIELDNAMELEN - 2);
-			tmp_name[strlen(name) + 1] = '\0';
-			tmp_name[0] = tmp_name[1] = '_';
-			strcpy(name, tmp_name);
+			char tmp[MAXFIELDNAMELEN] = "__";
+			memcpy(tmp+2, name, MAXFIELDNAMELEN-2);
+			tmp[MAXFIELDNAMELEN-1] = '\0';
 		}
 
 		/* Avoid duplicating field names */

-----------------------------------------------------------------------

Summary of changes:
 loader/shp2pgsql-core.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list