From 01171ddb20034578c616d0ba07f0268ab71809da Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 18 Jan 2012 11:14:24 -0500 Subject: Move sized_string declaration to utils --- src/responder/nss/nsssrv.h | 8 -------- src/responder/nss/nsssrv_cmd.c | 11 ----------- src/util/util.c | 11 +++++++++++ src/util/util.h | 8 ++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/responder/nss/nsssrv.h b/src/responder/nss/nsssrv.h index 5e365d7b3..01a2810cd 100644 --- a/src/responder/nss/nsssrv.h +++ b/src/responder/nss/nsssrv.h @@ -71,12 +71,4 @@ int nss_cmd_execute(struct cli_ctx *cctx); struct sss_cmd_table *get_nss_cmds(void); -/* len includes terminating '\0' */ -struct sized_string { - const char *str; - size_t len; -}; - -void to_sized_string(struct sized_string *out, const char *in); - #endif /* __NSSSRV_H__ */ diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c index e3420fa2e..4b5f6784c 100644 --- a/src/responder/nss/nsssrv_cmd.c +++ b/src/responder/nss/nsssrv_cmd.c @@ -28,17 +28,6 @@ #include "db/sysdb.h" #include -/* out->len includes terminating '\0' */ -void to_sized_string(struct sized_string *out, const char *in) -{ - out->str = in; - if (out->str) { - out->len = strlen(out->str) + 1; - } else { - out->len = 0; - } -} - static int nss_cmd_send_error(struct nss_cmd_ctx *cmdctx, int err) { struct cli_ctx *cctx = cmdctx->cctx; diff --git a/src/util/util.c b/src/util/util.c index f525c915b..ff55fdd7c 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -598,3 +598,14 @@ sss_escape_ip_address(TALLOC_CTX *mem_ctx, int family, const char *addr) return family == AF_INET6 ? talloc_asprintf(mem_ctx, "[%s]", addr) : talloc_strdup(mem_ctx, addr); } + +/* out->len includes terminating '\0' */ +void to_sized_string(struct sized_string *out, const char *in) +{ + out->str = in; + if (out->str) { + out->len = strlen(out->str) + 1; + } else { + out->len = 0; + } +} diff --git a/src/util/util.h b/src/util/util.h index 5428f0af6..30413d9ce 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -512,4 +512,12 @@ sss_tc_utf8_str_tolower(TALLOC_CTX *mem_ctx, const char *s); uint8_t * sss_tc_utf8_tolower(TALLOC_CTX *mem_ctx, const uint8_t *s, size_t len, size_t *_nlen); +/* len includes terminating '\0' */ +struct sized_string { + const char *str; + size_t len; +}; + +void to_sized_string(struct sized_string *out, const char *in); + #endif /* __SSSD_UTIL_H__ */ -- cgit