diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-10-25 02:14:22 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-10-25 02:14:22 +0000 |
commit | 789d0750215f3612642b3201ffccb42cc866d2ea (patch) | |
tree | eb3b90c47d3977a4a34d35a5e61f585d8077532a /src | |
parent | f3af1368bde01a75c5c37d2ad45aac83b92ae74c (diff) | |
download | postgresql-789d0750215f3612642b3201ffccb42cc866d2ea.tar.gz postgresql-789d0750215f3612642b3201ffccb42cc866d2ea.zip |
StrNCpy cleanup.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/c.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/include/c.h b/src/include/c.h index f38a8b10f09..2f53a0b09a9 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -7,7 +7,7 @@ * * 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 */ /* we do this so if the macro is used in an if action, it will work */ -#define StrNCpy(dst,src,len) do { \ - strncpy((dst),(src),(len)); \ - if (len > 0) \ - *((dst)+(len)-1)='\0'; \ - } while (0) +#define StrNCpy(dst,src,len) \ + (strncpy((dst),(src),(len)),(len > 0) ? *((dst)+(len)-1)='\0' : NULL,(dst)) /* Get a bit mask of the bits set in non-int32 aligned addresses */ #define INT_ALIGN_MASK (sizeof(int32) - 1) |