Displaying 16 results from an estimated 16 matches for "makestrspace".
2020 Mar 28
0
[klibc:update-dash] dash: expand: Ensure result is escaped in cvtnum
...ng on the stack.
*/
-static void memtodest(const char *p, size_t len, int flags)
+static size_t memtodest(const char *p, size_t len, int flags)
{
const char *syntax = flags & EXP_QUOTED ? DQSYNTAX : BASESYNTAX;
char *q;
+ char *s;
if (unlikely(!len))
- return;
+ return 0;
q = makestrspace(len * 2, expdest);
+ s = q;
do {
int c = (signed char)*p++;
@@ -818,6 +820,7 @@ static void memtodest(const char *p, size_t len, int flags)
} while (--len);
expdest = q;
+ return q - s;
}
@@ -875,7 +878,7 @@ varvalue(char *name, int varflags, int flags, int quoted)
if (num == 0...
2019 Jan 25
0
[klibc:update-dash] builtin: Fix echo performance regression
...char *f, int *param, int *array, char *s)
int total;
setstackmark(&smark);
- done = conv_escape_str(s, &p);
- q = stackblock();
- len = p - q;
+ done = conv_escape_str(s, &q);
+ p = stackblock();
+ len = q - p;
+ total = len - 1;
+
+ if (f[1] == 's')
+ goto easy;
- p = makestrspace(len, p);
- memset(p, 'X', len - 1);
- p[len - 1] = 0;
+ p = makestrspace(len, q);
+ memset(p, 'X', total);
+ p[total] = 0;
q = stackblock();
total = ASPF(&p, f, p);
len = strchrnul(p, 'X') - p;
- memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Fix echo performance regression
...char *f, int *param, int *array, char *s)
int total;
setstackmark(&smark);
- done = conv_escape_str(s, &p);
- q = stackblock();
- len = p - q;
+ done = conv_escape_str(s, &q);
+ p = stackblock();
+ len = q - p;
+ total = len - 1;
+
+ if (f[1] == 's')
+ goto easy;
- p = makestrspace(len, p);
- memset(p, 'X', len - 1);
- p[len - 1] = 0;
+ p = makestrspace(len, q);
+ memset(p, 'X', total);
+ p[total] = 0;
q = stackblock();
total = ASPF(&p, f, p);
len = strchrnul(p, 'X') - p;
- memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));...
2012 Jul 02
0
[klibc:master] [MEMALLOC] Avoid clang warning about dead store to "size"
...c2c4cb83
Author: Jim Meyering <meyering at redhat.com>
AuthorDate: Fri, 8 Jul 2011 16:16:11 +0800
Committer: maximilian attems <max at stro.at>
CommitDate: Mon, 2 Jul 2012 10:44:45 +0200
[klibc] [MEMALLOC] Avoid clang warning about dead store to "size"
* src/memalloc.c (makestrspace): Remove dead store.
Signed-off-by: Jim Meyering <meyering at redhat.com>
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: maximilian attems <max at stro.at>
---
usr/dash/memalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git...
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...emalloc.c
+++ b/usr/dash/memalloc.c
@@ -265,6 +265,14 @@ growstackstr(void)
return stackblock() + len;
}
+char *growstackto(size_t len)
+{
+ while (stackblocksize() < len)
+ growstackblock();
+
+ return stackblock();
+}
+
/*
* Called from CHECKSTRSPACE.
*/
@@ -273,18 +281,8 @@ char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;
- size_t size;
- for (;;) {
- size_t nleft;
-
- size = stackblocksize();
- nleft = size - len;
- if (nleft >= newlen)
- break;
- growstackblock();
- }
- return stackblock() + len;
+ return growstackto(len + newlen) + len;
}
cha...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Use PRIdMAX instead of %j in printf
...+++ b/src/bltin/printf.c
>> @@ -319,11 +319,12 @@ mklong(const char *str, const char *ch)
>> char *copy;
>> size_t len;
>>
>> - len = ch - str + 3;
>> + len = ch - str + 4;
>> STARTSTACKSTR(copy);
>> copy = makestrspace(len, copy);
>> - memcpy(copy, str, len - 3);
>> - copy[len - 3] = 'j';
>> + memcpy(copy, str, len - 4);
>> + copy[len - 4] = 'l';
>> + copy[len - 3] = 'l';
>> copy[len - 2] = *ch;
>> copy...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Use PRIdMAX instead of %j in printf
...+++ b/src/bltin/printf.c
>> @@ -319,11 +319,12 @@ mklong(const char *str, const char *ch)
>> char *copy;
>> size_t len;
>>
>> - len = ch - str + 3;
>> + len = ch - str + 4;
>> STARTSTACKSTR(copy);
>> copy = makestrspace(len, copy);
>> - memcpy(copy, str, len - 3);
>> - copy[len - 3] = 'j';
>> + memcpy(copy, str, len - 4);
>> + copy[len - 4] = 'l';
>> + copy[len - 3] = 'l';
>> copy[len - 2] = *ch;
>> copy...
2019 Jan 25
0
[klibc:update-dash] expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
...ngs <ben at decadent.org.uk>
---
usr/dash/expand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index 153f6b7a..e86bd29d 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -927,7 +927,7 @@ numvar:
case '-':
p = makestrspace(NOPTS, expdest);
for (i = NOPTS - 1; i >= 0; i--) {
- if (optlist[i]) {
+ if (optlist[i] && optletters[i]) {
USTPUTC(optletters[i], p);
len++;
}
2020 Mar 28
0
[klibc:update-dash] dash: expand: 'nolog' and 'debug' options cause "$-" to wreak havoc
...ngs <ben at decadent.org.uk>
---
usr/dash/expand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index 153f6b7a..e86bd29d 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -927,7 +927,7 @@ numvar:
case '-':
p = makestrspace(NOPTS, expdest);
for (i = NOPTS - 1; i >= 0; i--) {
- if (optlist[i]) {
+ if (optlist[i] && optletters[i]) {
USTPUTC(optletters[i], p);
len++;
}
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Avoid looping in growstackto
...+++ b/usr/dash/memalloc.h
@@ -55,7 +55,6 @@ void stunalloc(pointer);
void pushstackmark(struct stackmark *mark, size_t len);
void setstackmark(struct stackmark *);
void popstackmark(struct stackmark *);
-void growstackblock(void);
void *growstackstr(void);
char *growstackto(size_t len);
char *makestrspace(size_t, char *);
2010 Mar 22
1
[git pull] dash, sh4, README's
...ns
[klibc] [BUILTIN] Disallow completely blank strings in non-arithmetic context.
Richard M Kreuter (1):
[klibc] [BUILTIN] Add set +o support
Rocky Bernstein (1):
[klibc] [SHELL] Add preliminary LINENO support
Roy Marples (1):
[klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes
Stefan Potyra (1):
[klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd
Steve Langasek (1):
[klibc] [EVAL] Fix bad pointer arithmetic in evalcommand
maximilian attems (5):
[klibc] mv worthwile README's to ease packaging
[klibc]...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
...break; \
+ } \
+ ret; \
+})
+
+
+static int print_escape_str(const char *f, int *param, int *array, char *s)
+{
+ struct stackmark smark;
+ char *p, *q;
+ int done;
+ int len;
+ int total;
+
+ setstackmark(&smark);
+ done = conv_escape_str(s, &p);
+ q = stackblock();
+ len = p - q;
+
+ p = makestrspace(len, p);
+ memset(p, 'X', len - 1);
+ p[len - 1] = 0;
+
+ q = stackblock();
+ total = ASPF(&p, f, p);
+
+ len = strchrnul(p, 'X') - p;
+ memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));
+
+ out1mem(p, total);
+
+ popstackmark(&smark);
+ return done;
+}
+
+
i...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
...break; \
+ } \
+ ret; \
+})
+
+
+static int print_escape_str(const char *f, int *param, int *array, char *s)
+{
+ struct stackmark smark;
+ char *p, *q;
+ int done;
+ int len;
+ int total;
+
+ setstackmark(&smark);
+ done = conv_escape_str(s, &p);
+ q = stackblock();
+ len = p - q;
+
+ p = makestrspace(len, p);
+ memset(p, 'X', len - 1);
+ p[len - 1] = 0;
+
+ q = stackblock();
+ total = ASPF(&p, f, p);
+
+ len = strchrnul(p, 'X') - p;
+ memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));
+
+ out1mem(p, total);
+
+ popstackmark(&smark);
+ return done;
+}
+
+
i...
2010 Apr 16
0
[git pull v4] dash, sh4, ipconfig, dprintf, fstype, README's
...ns
[klibc] [BUILTIN] Disallow completely blank strings in non-arithmetic context.
Richard M Kreuter (1):
[klibc] [BUILTIN] Add set +o support
Rocky Bernstein (1):
[klibc] [SHELL] Add preliminary LINENO support
Roy Marples (1):
[klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes
Stefan Potyra (1):
[klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd
Steve Langasek (1):
[klibc] [EVAL] Fix bad pointer arithmetic in evalcommand
maximilian attems (13):
[klibc] mv worthwile README's to ease packaging
[klibc]...
2010 Apr 16
0
[PATCH] pull faccessat() system call
...ns
[klibc] [BUILTIN] Disallow completely blank strings in non-arithmetic context.
Richard M Kreuter (1):
[klibc] [BUILTIN] Add set +o support
Rocky Bernstein (1):
[klibc] [SHELL] Add preliminary LINENO support
Roy Marples (1):
[klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes
Stefan Potyra (1):
[klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd
Steve Langasek (1):
[klibc] [EVAL] Fix bad pointer arithmetic in evalcommand
maximilian attems (13):
[klibc] mv worthwile README's to ease packaging
[klibc]...
2010 Mar 28
1
[git pull v3] dash, sh4, ipconfig, dprintf, fstype, README's
...ns
[klibc] [BUILTIN] Disallow completely blank strings in non-arithmetic context.
Richard M Kreuter (1):
[klibc] [BUILTIN] Add set +o support
Rocky Bernstein (1):
[klibc] [SHELL] Add preliminary LINENO support
Roy Marples (1):
[klibc] [EXPAND] Refresh stack pointers after makestrspace in _rmescapes
Stefan Potyra (1):
[klibc] [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd
Steve Langasek (1):
[klibc] [EVAL] Fix bad pointer arithmetic in evalcommand
maximilian attems (10):
[klibc] mv worthwile README's to ease packaging
[klibc]...