projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
better error handling in whatnow2
[mmh]
/
sbr
/
putenv.c
diff --git
a/sbr/putenv.c
b/sbr/putenv.c
index
5c7279b
..
c47f26e
100644
(file)
--- a/
sbr/putenv.c
+++ b/
sbr/putenv.c
@@
-22,10
+22,10
@@
static int nvmatch(char *, char *);
int
m_putenv(char *name, char *value)
{
int
m_putenv(char *name, char *value)
{
- register int i;
- register char **ep, **nep, *cp;
+ int i;
+ char **ep, **nep, *cp;
- cp = mh_xmalloc((size_t) (strlen(name) + strlen(value) + 2));
+ cp = mh_xcalloc(strlen(name) + strlen(value) + 2, sizeof(char));
sprintf(cp, "%s=%s", name, value);
sprintf(cp, "%s=%s", name, value);
@@
-35,7
+35,7
@@
m_putenv(char *name, char *value)
return 0;
}
return 0;
}
- nep = (char **) mh_xmalloc((size_t) ((i + 2) * sizeof(*nep)));
+ nep = mh_xcalloc(i + 2, sizeof(*nep));
for (ep = environ, i = 0; *ep; nep[i++] = *ep++)
continue;
for (ep = environ, i = 0; *ep; nep[i++] = *ep++)
continue;