Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit789d075

Browse files
committed
StrNCpy cleanup.
1 parentf3af136 commit789d075

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/2501:10:58 momjian Exp $
10+
* $Id: c.h,v 1.24 1997/10/2502: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-
#defineStrNCpy(dst,src,len)do { \
694-
strncpy((dst),(src),(len)); \
695-
if (len > 0) \
696-
*((dst)+(len)-1)='\0'; \
697-
} while (0)
693+
#defineStrNCpy(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
#defineINT_ALIGN_MASK (sizeof(int32) - 1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp