diff options
author | Linus Nordberg <linus@nordu.net> | 2012-04-26 10:03:42 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2012-04-26 10:08:02 +0200 |
commit | a8609e55bd16b14a888535a7e2659b3217a9d1c7 (patch) | |
tree | 7a505f73b7372895179676866ac0a5868f7ac545 /lib/util.c | |
parent | 9b9df4b9bfc3550fdcf61f173711603c27bf48f6 (diff) |
Add util.h and util.c.
Diffstat (limited to 'lib/util.c')
-rw-r--r-- | lib/util.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/util.c b/lib/util.c new file mode 100644 index 0000000..3c9fef6 --- /dev/null +++ b/lib/util.c @@ -0,0 +1,19 @@ +/* Copyright 2012 NORDUnet A/S. All rights reserved. + See the file COPYING for licensing information. */ + +#include <string.h> +#include <radsec/radsec.h> +#include <radsec/radsec-impl.h> +#include "util.h" + +char * +rs_strdup (struct rs_context *ctx, const char *s) +{ + char *buf = rs_calloc (ctx, 1, strlen (s) + 1); + + if (buf != NULL) + return strcpy (buf, s); + + rs_err_ctx_push (ctx, RSE_NOMEM, NULL); + return NULL; +} |