libexport.a: Clean up client_add() From: Chuck Lever Clean up: client_add()'s current callers never set unknown m_type values, so the m_type check is unnecessary. All of client_add()'s callers are in the same source file where it is defined, so make it a static helper function. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- support/export/client.c | 26 ++++++++++++-------------- support/include/exportfs.h | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) --- nfs-utils-1.2.1.orig/support/export/client.c +++ nfs-utils-1.2.1/support/export/client.c @@ -113,6 +113,18 @@ client_init(nfs_client *clp, const char return 1; } +static void +client_add(nfs_client *clp) +{ + nfs_client **cpp; + + cpp = &clientlist[clp->m_type]; + while (*cpp != NULL) + cpp = &((*cpp)->m_next); + clp->m_next = NULL; + *cpp = clp; +} + /* if canonical is set, then we *know* this is already a canonical name * so hostname lookup is avoided. * This is used when reading /proc/fs/nfs/exports @@ -209,20 +221,6 @@ client_dup(nfs_client *clp, struct hoste } void -client_add(nfs_client *clp) -{ - nfs_client **cpp; - - if (clp->m_type < 0 || clp->m_type >= MCL_MAXTYPES) - xlog(L_FATAL, "unknown client type in client_add"); - cpp = clientlist + clp->m_type; - while (*cpp) - cpp = &((*cpp)->m_next); - clp->m_next = NULL; - *cpp = clp; -} - -void client_release(nfs_client *clp) { if (clp->m_count <= 0) --- nfs-utils-1.2.1.orig/support/include/exportfs.h +++ nfs-utils-1.2.1/support/include/exportfs.h @@ -70,7 +70,6 @@ extern nfs_client * clientlist[MCL_MAXT nfs_client * client_lookup(char *hname, int canonical); nfs_client * client_find(struct hostent *); -void client_add(nfs_client *); nfs_client * client_dup(nfs_client *, struct hostent *); int client_gettype(char *hname); int client_check(nfs_client *, struct hostent *);