summaryrefslogtreecommitdiff
path: root/src/libexecline/el_pushenv.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-07 20:31:02 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-07 20:31:02 +0000
commit6a9ca73e10c3c4e8a95101313e9c5d46cf018f86 (patch)
tree41ae80cb08fa1e280012b799ad0d1e63090b19bc /src/libexecline/el_pushenv.c
parent6245dcef12eed3b12b129519eeaf11f7e221d278 (diff)
downloadexecline-6a9ca73e10c3c4e8a95101313e9c5d46cf018f86.tar.xz
Types fix: first pass
This pass makes variable size_t-ready, so everything works when the prototypes are fixed in skalibs. Some code uses "unsigned int *" where it should be "size_t *"; it cannot be changed now, but it's been marked with XXX. It must change at the same time as the skalibs API.
Diffstat (limited to 'src/libexecline/el_pushenv.c')
-rw-r--r--src/libexecline/el_pushenv.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libexecline/el_pushenv.c b/src/libexecline/el_pushenv.c
index 9b9608d..4ec43bb 100644
--- a/src/libexecline/el_pushenv.c
+++ b/src/libexecline/el_pushenv.c
@@ -1,18 +1,19 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <skalibs/stralloc.h>
#include <skalibs/uint.h>
#include <execline/execline.h>
-int el_pushenv (stralloc *sa, char const *const *envp, unsigned int envlen, char const *const *list, unsigned int listlen)
+int el_pushenv (stralloc *sa, char const *const *envp, size_t envlen, char const *const *list, size_t listlen)
{
- unsigned int i = 0, salen = sa->len, count = 0 ;
+ size_t i = 0, salen = sa->len ;
+ int count = 0 ;
for (; i < envlen ; i++)
{
- unsigned int equal, colon ;
- unsigned int j = 0 ;
+ size_t equal, colon, j = 0 ;
for (; j < listlen ; j++) if (str_start(envp[i], list[j])) break ;
if (j == listlen) goto copyit ;
count++ ;
@@ -27,8 +28,8 @@ int el_pushenv (stralloc *sa, char const *const *envp, unsigned int envlen, char
}
else
{
+ size_t n ;
char fmt[UINT_FMT+1] = ":" ;
- unsigned int n ;
if (colon + 1 + uint_scan(envp[i] + colon + 1, &n) != equal) goto copyit ;
n = 1 + uint_fmt(fmt+1, n+1) ;
if (!stralloc_catb(sa, envp[i], colon)) goto err ;
@@ -39,7 +40,7 @@ int el_pushenv (stralloc *sa, char const *const *envp, unsigned int envlen, char
copyit:
if (!stralloc_catb(sa, envp[i], str_len(envp[i]) + 1)) goto err ;
}
- return (int)count ;
+ return count ;
badenv :
errno = EINVAL ;