diff options
author | wtc%netscape.com <devnull@localhost> | 2002-05-01 00:06:39 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2002-05-01 00:06:39 +0000 |
commit | e23f0cc1fb3ec79374a9fe8f4d475f12d0838550 (patch) | |
tree | 6b412db6adbfc3b98d47398e8bf62ec4d6d600d7 | |
parent | 429ff2e354eb9e5a96987f535695fa60253192d1 (diff) | |
download | nss-hg-e23f0cc1fb3ec79374a9fe8f4d475f12d0838550.tar.gz |
Bugzilla bug 131057: define PORT_Strdup as a function that calls PORT_Alloc.
Modified files:
lib/ckfw/nsprstub.c lib/fortcrypt/swfort/pkcs11/stub.c
lib/nss/nss.def lib/util/secport.c lib/util/secport.h
-rw-r--r-- | security/nss/lib/ckfw/nsprstub.c | 2 | ||||
-rw-r--r-- | security/nss/lib/fortcrypt/swfort/pkcs11/stub.c | 15 | ||||
-rw-r--r-- | security/nss/lib/nss/nss.def | 1 | ||||
-rw-r--r-- | security/nss/lib/util/secport.c | 15 | ||||
-rw-r--r-- | security/nss/lib/util/secport.h | 6 |
5 files changed, 33 insertions, 6 deletions
diff --git a/security/nss/lib/ckfw/nsprstub.c b/security/nss/lib/ckfw/nsprstub.c index e4c33cdbd..c9e3964d9 100644 --- a/security/nss/lib/ckfw/nsprstub.c +++ b/security/nss/lib/ckfw/nsprstub.c @@ -200,7 +200,7 @@ PORT_ArenaUnmark(PLArenaPool *arena, void *mark) } char * -PORT_ArenaStrdup(PLArenaPool *arena,char *str) { +PORT_ArenaStrdup(PLArenaPool *arena,const char *str) { int len = PORT_Strlen(str)+1; char *newstr; diff --git a/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c b/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c index e3b854f3d..0f673e77b 100644 --- a/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c +++ b/security/nss/lib/fortcrypt/swfort/pkcs11/stub.c @@ -115,6 +115,19 @@ PORT_ZFree(void *ptr, size_t len) } } +char * +PORT_Strdup(const char *str) +{ + size_t len = PORT_Strlen(str)+1; + char *newstr; + + newstr = (char *)PORT_Alloc(len); + if (newstr) { + PORT_Memcpy(newstr, str, len); + } + return newstr; +} + void PORT_SetError(int value) { @@ -210,7 +223,7 @@ PORT_ArenaUnmark(PLArenaPool *arena, void *mark) } char * -PORT_ArenaStrdup(PLArenaPool *arena,char *str) { +PORT_ArenaStrdup(PLArenaPool *arena,const char *str) { int len = PORT_Strlen(str)+1; char *newstr; diff --git a/security/nss/lib/nss/nss.def b/security/nss/lib/nss/nss.def index 38240feac..bb9bf3f7b 100644 --- a/security/nss/lib/nss/nss.def +++ b/security/nss/lib/nss/nss.def @@ -675,6 +675,7 @@ CERT_FinishExtensions; CERT_StartCertExtensions; DER_AsciiToTime; PK11_ImportCert; +PORT_Strdup; ;+ local: ;+ *; ;+}; diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c index 727b141e5..276cf6208 100644 --- a/security/nss/lib/util/secport.c +++ b/security/nss/lib/util/secport.c @@ -159,6 +159,19 @@ PORT_ZFree(void *ptr, size_t len) } } +char * +PORT_Strdup(const char *str) +{ + size_t len = PORT_Strlen(str)+1; + char *newstr; + + newstr = (char *)PORT_Alloc(len); + if (newstr) { + PORT_Memcpy(newstr, str, len); + } + return newstr; +} + void PORT_SetError(int value) { @@ -446,7 +459,7 @@ PORT_ArenaUnmark(PLArenaPool *arena, void *mark) } char * -PORT_ArenaStrdup(PLArenaPool *arena, char *str) { +PORT_ArenaStrdup(PLArenaPool *arena, const char *str) { int len = PORT_Strlen(str)+1; char *newstr; diff --git a/security/nss/lib/util/secport.h b/security/nss/lib/util/secport.h index 281b57ef6..b154c0915 100644 --- a/security/nss/lib/util/secport.h +++ b/security/nss/lib/util/secport.h @@ -144,7 +144,7 @@ extern void *PORT_ArenaGrow(PLArenaPool *arena, void *ptr, extern void *PORT_ArenaMark(PLArenaPool *arena); extern void PORT_ArenaRelease(PLArenaPool *arena, void *mark); extern void PORT_ArenaUnmark(PLArenaPool *arena, void *mark); -extern char *PORT_ArenaStrdup(PLArenaPool *arena, char *str); +extern char *PORT_ArenaStrdup(PLArenaPool *arena, const char *str); #ifdef __cplusplus } @@ -210,10 +210,10 @@ extern char *PORT_ArenaStrdup(PLArenaPool *arena, char *str); #define PORT_Strcasecmp PL_strcasecmp #define PORT_Strcat strcat #define PORT_Strchr strchr -#define PORT_Strrchr PL_strrchr +#define PORT_Strrchr strrchr #define PORT_Strcmp strcmp #define PORT_Strcpy strcpy -#define PORT_Strdup PL_strdup +extern char *PORT_Strdup(const char *s); #define PORT_Strlen(s) strlen(s) #define PORT_Strncasecmp PL_strncasecmp #define PORT_Strncat strncat |