path.c char[strlen("xxx")] not portable

Started by Zeugswetter Andreas SB SDabout 22 years ago2 messagespatches
Jump to latest
#1Zeugswetter Andreas SB SD
ZeugswetterA@spardat.at

strlen inside variable declaration is not portable C (AIX):

char env_path[MAXPGPATH + strlen("PGLOCALEDIR=")];

use sizeof instead.

Please apply to current

Andreas

Attachments:

path.c.locale.patchapplication/octet-stream; name=path.c.locale.patchDownload+2-2
#2Bruce Momjian
bruce@momjian.us
In reply to: Zeugswetter Andreas SB SD (#1)
Re: path.c char[strlen("xxx")] not portable

Patch applied. The only reason I used strlen is because sizeof a string
is one more than the strlen().

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

Zeugswetter Andreas SB SD wrote:

strlen inside variable declaration is not portable C (AIX):

char env_path[MAXPGPATH + strlen("PGLOCALEDIR=")];

use sizeof instead.

Please apply to current

Andreas

Content-Description: path.c.locale.patch

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073