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_delete.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 <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_delete, (argz, argz_len, entry),
15
       char **argz _AND
16
       size_t *argz_len _AND
17
       char *entry)
18
{
19
  int len = 0;
20
  char *moveto = entry;
21
 
22
  if (entry)
23
    {
24
      len = strlen(entry) + 1;
25
      entry += len;
26
 
27
      memmove(moveto, entry, *argz + *argz_len - entry);
28
 
29
      *argz_len -= len;
30
 
31
      if(!(*argz = (char *)realloc(*argz, *argz_len)))
32
        return ENOMEM;
33
 
34
      if (*argz_len <= 0)
35
        {
36
          free(*argz);
37
          *argz = NULL;
38
        }
39
    }
40
  return 0;
41
}

powered by: WebSVN 2.1.0

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