Skip to content

Commit 789d075

Browse files
committed
StrNCpy cleanup.
1 parent f3af136 commit 789d075

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/include/c.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: c.h,v 1.23 1997/10/25 01:10:58 momjian Exp $
10+
* $Id: c.h,v 1.24 1997/10/25 02:14:22 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -690,11 +690,8 @@ typedef struct Exception
690690
* Does string copy, and forces terminating NULL
691691
*/
692692
/* we do this so if the macro is used in an if action, it will work */
693-
#define StrNCpy(dst,src,len) do { \
694-
strncpy((dst),(src),(len)); \
695-
if (len > 0) \
696-
*((dst)+(len)-1)='\0'; \
697-
} while (0)
693+
#define StrNCpy(dst,src,len) \
694+
(strncpy((dst),(src),(len)),(len > 0) ? *((dst)+(len)-1)='\0' : NULL,(dst))
698695

699696
/* Get a bit mask of the bits set in non-int32 aligned addresses */
700697
#define INT_ALIGN_MASK (sizeof(int32) - 1)

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