Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
89a0e3a9
Commit
89a0e3a9
authored
Nov 09, 2006
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the last strcpy() call by using an static inline function.
parent
a8facdc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
system.h
popt/system.h
+17
-9
No files found.
popt/system.h
View file @
89a0e3a9
...
...
@@ -95,9 +95,25 @@ char * xstrdup (const char *str)
/*@*/
;
/*@=redecl =redef@*/
#ifndef HAVE_STRLCPY
size_t
strlcpy
(
char
*
d
,
const
char
*
s
,
size_t
bufsize
);
#endif
#ifndef HAVE_STRLCAT
size_t
strlcat
(
char
*
d
,
const
char
*
s
,
size_t
bufsize
);
#endif
#if HAVE_MCHECK_H && defined(__GNUC__)
#define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
static
inline
char
*
xstrdup
(
const
char
*
s
)
{
size_t
memsize
=
strlen
(
s
)
+
1
;
char
*
ptr
=
malloc
(
memsize
);
if
(
!
ptr
)
vmefail
();
strlcpy
(
ptr
,
s
,
memsize
);
return
ptr
;
}
#else
#define xstrdup(_str) strdup(_str)
#endif
/* HAVE_MCHECK_H && defined(__GNUC__) */
...
...
@@ -106,14 +122,6 @@ char * xstrdup (const char *str)
#define getenv(_s) __secure_getenv(_s)
#endif
#ifndef HAVE_STRLCPY
size_t
strlcpy
(
char
*
d
,
const
char
*
s
,
size_t
bufsize
);
#endif
#ifndef HAVE_STRLCAT
size_t
strlcat
(
char
*
d
,
const
char
*
s
,
size_t
bufsize
);
#endif
#if !defined HAVE_SNPRINTF || !defined HAVE_C99_VSNPRINTF
#define snprintf rsync_snprintf
int
snprintf
(
char
*
str
,
size_t
count
,
const
char
*
fmt
,...);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment