@@ -354,6 +354,18 @@ pg_strdup(const char *s)
354
354
return result ;
355
355
}
356
356
357
+ static char *
358
+ escape_quotes (const char * src )
359
+ {
360
+ char * result = escape_single_quotes_ascii (src );
361
+ if (!result )
362
+ {
363
+ fprintf (stderr , _ ("%s: out of memory\n" ), progname );
364
+ exit (1 );
365
+ }
366
+ return result ;
367
+ }
368
+
357
369
/*
358
370
* make a copy of the array of lines, with token replaced by replacement
359
371
* the first time it occurs on each line.
@@ -2415,35 +2427,6 @@ check_ok(void)
2415
2427
}
2416
2428
}
2417
2429
2418
- /*
2419
- * Escape (by doubling) any single quotes or backslashes in given string
2420
- *
2421
- * Note: this is used to process both postgresql.conf entries and SQL
2422
- * string literals. Since postgresql.conf strings are defined to treat
2423
- * backslashes as escapes, we have to double backslashes here. Hence,
2424
- * when using this for a SQL string literal, use E'' syntax.
2425
- *
2426
- * We do not need to worry about encoding considerations because all
2427
- * valid backend encodings are ASCII-safe.
2428
- */
2429
- static char *
2430
- escape_quotes (const char * src )
2431
- {
2432
- int len = strlen (src ),
2433
- i ,
2434
- j ;
2435
- char * result = pg_malloc (len * 2 + 1 );
2436
-
2437
- for (i = 0 , j = 0 ; i < len ; i ++ )
2438
- {
2439
- if (SQL_STR_DOUBLE (src [i ], true))
2440
- result [j ++ ] = src [i ];
2441
- result [j ++ ] = src [i ];
2442
- }
2443
- result [j ] = '\0' ;
2444
- return result ;
2445
- }
2446
-
2447
2430
/* Hack to suppress a warning about %x from some versions of gcc */
2448
2431
static inline size_t
2449
2432
my_strftime (char * s , size_t max , const char * fmt , const struct tm * tm )
0 commit comments