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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [argz/] [argz_append.c] - Blame information for rev 148

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 <argz.h>
8
#include <errno.h>
9
#include <sys/types.h>
10
#include <string.h>
11
#include <stdlib.h>
12
 
13
error_t
14
_DEFUN (argz_append, (argz, argz_len, buf, buf_len),
15
       char **argz _AND
16
       size_t *argz_len _AND
17
       const char *buf _AND
18
       size_t buf_len)
19
{
20
  if (buf_len)
21
    {
22
      size_t last = *argz_len;
23
 
24
      *argz_len += buf_len;
25
 
26
      if(!(*argz = (char *)realloc(*argz, *argz_len)))
27
        return ENOMEM;
28
 
29
      memcpy(*argz + last, buf, buf_len);
30
    }
31
  return 0;
32
}

powered by: WebSVN 2.1.0

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