Skip to content

Commit ba34215

Browse files
author
Michael Meskes
committed
Removed strchrnul
1 parent d703de2 commit ba34215

File tree

1 file changed

+5
-4
lines changed
  • src/interfaces/ecpg/preproc

1 file changed

+5
-4
lines changed

src/interfaces/ecpg/preproc/type.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.80 2008/11/26 13:18:22 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.81 2008/11/26 15:35:30 meskes Exp $ */
22

33
#include "postgres_fe.h"
44

@@ -329,7 +329,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
329329
{
330330
char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
331331
char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3);
332-
char *var_name;
332+
char *var_name, *ptr;
333333

334334
switch (type)
335335
{
@@ -352,8 +352,9 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
352352
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
353353

354354
/* remove trailing [] is name is array element */
355-
var_name = strdup(name);
356-
*(strchrnul(var_name, '[')) = '\0';
355+
var_name = mm_strdup(name);
356+
ptr = strchr(var_name, '[');
357+
if (ptr) *ptr = '\0';
357358
if (lineno)
358359
sprintf(offset, "sizeof(struct varchar_%s_%d)", var_name, lineno);
359360
else

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy