version 1.25, 2005/09/11 14:16:48 |
version 1.26, 2005/12/10 20:27:45 |
|
|
} |
} |
} |
} |
|
|
root = (struct cvsroot *)malloc(sizeof(*root)); |
root = (struct cvsroot *)xmalloc(sizeof(*root)); |
if (root == NULL) { |
|
cvs_log(LP_ERRNO, "failed to allocate CVS root data"); |
|
return (NULL); |
|
} |
|
memset(root, 0, sizeof(*root)); |
memset(root, 0, sizeof(*root)); |
root->cr_ref = 1; |
root->cr_ref = 1; |
root->cr_method = CVS_METHOD_NONE; |
root->cr_method = CVS_METHOD_NONE; |
|
|
CVS_SETVR(root, CVS_REQ_VALIDREQ); |
CVS_SETVR(root, CVS_REQ_VALIDREQ); |
CVS_SETVR(root, CVS_REQ_VALIDRESP); |
CVS_SETVR(root, CVS_REQ_VALIDRESP); |
|
|
root->cr_str = strdup(str); |
root->cr_str = xstrdup(str); |
if (root->cr_str == NULL) { |
root->cr_buf = xstrdup(str); |
free(root); |
|
return (NULL); |
|
} |
|
root->cr_buf = strdup(str); |
|
if (root->cr_buf == NULL) { |
|
cvs_log(LP_ERRNO, "failed to copy CVS root"); |
|
cvsroot_free(root); |
|
return (NULL); |
|
} |
|
|
|
sp = root->cr_buf; |
sp = root->cr_buf; |
cp = root->cr_buf; |
cp = root->cr_buf; |
|
|
cvsroot_free(struct cvsroot *root) |
cvsroot_free(struct cvsroot *root) |
{ |
{ |
if (root->cr_str != NULL) |
if (root->cr_str != NULL) |
free(root->cr_str); |
xfree(root->cr_str); |
if (root->cr_buf != NULL) |
if (root->cr_buf != NULL) |
free(root->cr_buf); |
xfree(root->cr_buf); |
if (root->cr_version != NULL) |
if (root->cr_version != NULL) |
free(root->cr_version); |
xfree(root->cr_version); |
free(root); |
xfree(root); |
} |
} |
|
|
/* |
/* |