File: util.c

package info (click to toggle)
libradsec 0.0.5-5.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,680 kB
  • sloc: sh: 11,411; ansic: 10,494; perl: 270; makefile: 175
file content (25 lines) | stat: -rw-r--r-- 485 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Copyright 2012-2013 NORDUnet A/S. All rights reserved.
   See LICENSE for licensing information. */

#include <stdlib.h>
#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)
{
  size_t len;
  char *buf;

  len = strlen (s);
  buf = rs_malloc (ctx, len + 1);

  if (buf != NULL)
    memcpy (buf, s, len + 1);
  else
    rs_err_ctx_push (ctx, RSE_NOMEM, __func__);

  return buf;
}