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

Subversion Repositories openrisc

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

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 <string.h>
10
#include <stdlib.h>
11
#include <argz.h>
12
#include <envz.h>
13
 
14
void
15
_DEFUN (envz_remove, (envz, envz_len, name),
16
       char **envz _AND
17
       size_t *envz_len _AND
18
       const char *name)
19
{
20
  char *entry = NULL;
21
  int len = 0;
22
  entry = envz_entry (*envz, *envz_len, name);
23
 
24
  if (entry)
25
    {
26
      len = strlen(entry) + 1;
27
 
28
      /* Not the last entry. */
29
      if (*envz + *envz_len != entry + len - 1)
30
        {
31
          memmove(entry, entry + len, *envz + *envz_len - entry - len);
32
        }
33
 
34
      *envz = (char *)realloc(*envz, *envz_len - len);
35
      *envz_len -= len;
36
    }
37
}

powered by: WebSVN 2.1.0

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