Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/port/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  quotes.c

  Sprache: C
 

/*-------------------------------------------------------------------------
 *
 * quotes.c
 *   string quoting and escaping functions
 *
 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *   src/port/quotes.c
 *
 *-------------------------------------------------------------------------
 */


#include "c.h"

/*
 * Escape (by doubling) any single quotes or backslashes in given string
 *
 * Note: this is used to process postgresql.conf entries and to quote
 * string literals in pg_basebackup for writing the recovery configuration.
 * Since postgresql.conf strings are defined to treat backslashes as escapes,
 * we have to double backslashes here.
 *
 * Since this function is only used for parsing or creating configuration
 * files, we do not care about encoding considerations.
 *
 * Returns a malloced() string that it's the responsibility of the caller
 * to free.
 */

char *
escape_single_quotes_ascii(const char *src)
{
 int   len = strlen(src),
    i,
    j;
 char    *result = malloc(len * 2 + 1);

 if (!result)
  return NULL;

 for (i = 0, j = 0; i < len; i++)
 {
  if (SQL_STR_DOUBLE(src[i], true))
   result[j++] = src[i];
  result[j++] = src[i];
 }
 result[j] = '\0';
 return result;
}

Messung V0.5 in Prozent
C=97 H=82 G=89

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.