=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/root.c,v retrieving revision 1.24 retrieving revision 1.25 diff -c -r1.24 -r1.25 *** src/usr.bin/cvs/root.c 2005/08/10 16:01:27 1.24 --- src/usr.bin/cvs/root.c 2005/09/11 14:16:48 1.25 *************** *** 1,4 **** ! /* $OpenBSD: root.c,v 1.24 2005/08/10 16:01:27 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: root.c,v 1.25 2005/09/11 14:16:48 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 66,71 **** --- 66,72 ---- * the result to the cache for future hits. */ static TAILQ_HEAD(, cvsroot) cvs_rcache = TAILQ_HEAD_INITIALIZER(cvs_rcache); + static void cvsroot_free(struct cvsroot *); /* * cvsroot_parse() *************** *** 220,248 **** return (root); } - /* ! * cvsroot_free() * ! * Free a CVSROOT structure previously allocated and returned by ! * cvsroot_parse(). */ void ! cvsroot_free(struct cvsroot *root) { root->cr_ref--; if (root->cr_ref == 0) { TAILQ_REMOVE(&cvs_rcache, root, root_cache); ! if (root->cr_str != NULL) ! free(root->cr_str); ! if (root->cr_buf != NULL) ! free(root->cr_buf); ! if (root->cr_version != NULL) ! free(root->cr_version); ! free(root); } } /* * cvsroot_get() --- 221,258 ---- return (root); } /* ! * cvsroot_remove() * ! * Remove a CVSROOT structure from the cache, and free it. */ void ! cvsroot_remove(struct cvsroot *root) { root->cr_ref--; if (root->cr_ref == 0) { TAILQ_REMOVE(&cvs_rcache, root, root_cache); ! cvsroot_free(root); } } + /* + * cvsroot_free() + * + * Free a CVSROOT structure previously allocated and returned by + * cvsroot_parse(). + */ + static void + cvsroot_free(struct cvsroot *root) + { + if (root->cr_str != NULL) + free(root->cr_str); + if (root->cr_buf != NULL) + free(root->cr_buf); + if (root->cr_version != NULL) + free(root->cr_version); + free(root); + } /* * cvsroot_get()