OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [argz/] [argz_add_sep.c] - Blame information for rev 171

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2
 *
3
 * Permission to use, copy, modify, and distribute this software
4
 * is freely granted, provided that this notice is preserved.
5
 */
6
 
7
#include <errno.h>
8
#include <sys/types.h>
9
#include <stdlib.h>
10
#include <string.h>
11
#include <argz.h>
12
 
13
error_t
14
_DEFUN (argz_add_sep, (argz, argz_len, str, sep),
15
       char **argz _AND
16
       size_t *argz_len _AND
17
       const char *str _AND
18
       int sep)
19
{
20
  char *str_argz = 0;
21
  size_t str_argz_len = 0;
22
  size_t last = *argz_len;
23
 
24
  argz_create_sep (str, sep, &str_argz, &str_argz_len);
25
 
26
  if (str_argz_len)
27
    {
28
      *argz_len += str_argz_len;
29
 
30
      if(!(*argz = (char *)realloc(*argz, *argz_len)))
31
        return ENOMEM;
32
 
33
      memcpy(*argz + last, str_argz, str_argz_len);
34
    }
35
  return 0;
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.