mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
StrNCpy cleanup.
This commit is contained in:
parent
f3af1368bd
commit
789d075021
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: c.h,v 1.23 1997/10/25 01:10:58 momjian Exp $
|
* $Id: c.h,v 1.24 1997/10/25 02:14:22 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -690,11 +690,8 @@ typedef struct Exception
|
|||||||
* Does string copy, and forces terminating NULL
|
* Does string copy, and forces terminating NULL
|
||||||
*/
|
*/
|
||||||
/* we do this so if the macro is used in an if action, it will work */
|
/* we do this so if the macro is used in an if action, it will work */
|
||||||
#define StrNCpy(dst,src,len) do { \
|
#define StrNCpy(dst,src,len) \
|
||||||
strncpy((dst),(src),(len)); \
|
(strncpy((dst),(src),(len)),(len > 0) ? *((dst)+(len)-1)='\0' : NULL,(dst))
|
||||||
if (len > 0) \
|
|
||||||
*((dst)+(len)-1)='\0'; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
/* Get a bit mask of the bits set in non-int32 aligned addresses */
|
/* Get a bit mask of the bits set in non-int32 aligned addresses */
|
||||||
#define INT_ALIGN_MASK (sizeof(int32) - 1)
|
#define INT_ALIGN_MASK (sizeof(int32) - 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user