mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 14:31:31 +00:00
ICU-3591 Fix uprv_strndup
X-SVN-Rev: 16753
This commit is contained in:
parent
533b801efc
commit
2df1c8eff4
1 changed files with 10 additions and 11 deletions
|
@ -311,19 +311,18 @@ uprv_strdup(const char *src) {
|
|||
|
||||
U_CAPI char* U_EXPORT2
|
||||
uprv_strndup(const char *src, int32_t n) {
|
||||
size_t len;
|
||||
char *dup;
|
||||
char *dup;
|
||||
|
||||
if(n < 0) {
|
||||
dup = uprv_strdup(src);
|
||||
} else {
|
||||
dup = (char*)uprv_malloc(n+1);
|
||||
if (dup) {
|
||||
uprv_memcpy(dup, src, n);
|
||||
dup[n] = 0;
|
||||
if(n < 0) {
|
||||
dup = uprv_strdup(src);
|
||||
} else {
|
||||
dup = (char*)uprv_malloc(n+1);
|
||||
if (dup) {
|
||||
uprv_memcpy(dup, src, n);
|
||||
dup[n] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dup;
|
||||
return dup;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue