diff options
Diffstat (limited to 'src/register.c')
-rw-r--r-- | src/register.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/register.c b/src/register.c index 20e60df..bcf95a2 100644 --- a/src/register.c +++ b/src/register.c @@ -85,8 +85,7 @@ IceIOErrorProc IOErrorProc; char *name; _IceProtocols[_IceLastMajorOpcode].protocol_name = name = - (char *) malloc (strlen (protocolName) + 1); - strcpy (name, protocolName); + strdup(protocolName); p = _IceProtocols[_IceLastMajorOpcode].orig_client = (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol)); @@ -96,11 +95,8 @@ IceIOErrorProc IOErrorProc; opcodeRet = ++_IceLastMajorOpcode; } - p->vendor = (char *) malloc (strlen (vendor) + 1); - strcpy (p->vendor, vendor); - - p->release = (char *) malloc (strlen (release) + 1); - strcpy (p->release, release); + p->vendor = strdup(vendor); + p->release = strdup(release); p->version_count = versionCount; @@ -119,10 +115,7 @@ IceIOErrorProc IOErrorProc; for (i = 0; i < authCount; i++) { - p->auth_names[i] = - (char *) malloc (strlen (authNames[i]) + 1); - strcpy (p->auth_names[i], authNames[i]); - + p->auth_names[i] = strdup(authNames[i]); p->auth_procs[i] = authProcs[i]; } } @@ -197,8 +190,7 @@ IceIOErrorProc IOErrorProc; char *name; _IceProtocols[_IceLastMajorOpcode].protocol_name = name = - (char *) malloc (strlen (protocolName) + 1); - strcpy (name, protocolName); + strdup(protocolName); _IceProtocols[_IceLastMajorOpcode].orig_client = NULL; @@ -208,11 +200,8 @@ IceIOErrorProc IOErrorProc; opcodeRet = ++_IceLastMajorOpcode; } - p->vendor = (char *) malloc (strlen (vendor) + 1); - strcpy (p->vendor, vendor); - - p->release = (char *) malloc (strlen (release) + 1); - strcpy (p->release, release); + p->vendor = strdup(vendor); + p->release = strdup(release); p->version_count = versionCount; @@ -234,10 +223,7 @@ IceIOErrorProc IOErrorProc; for (i = 0; i < authCount; i++) { - p->auth_names[i] = - (char *) malloc (strlen (authNames[i]) + 1); - strcpy (p->auth_names[i], authNames[i]); - + p->auth_names[i] = strdup(authNames[i]); p->auth_procs[i] = authProcs[i]; } } |