Displaying 12 results from an estimated 12 matches for "nextc".
Did you mean:
next
2020 Mar 28
0
[klibc:master] dash: output: Fix clang warnings about GNU old-style field designator
...822a577b06e2997f0793b402ae926 ]
Building with clang results in some warnings about the use of GNU
old-style field designators:
-----------------------------------------------------------------------
output.c:86:2: warning: use of GNU old-style field designator extension [-Wgnu-designator]
nextc: 0, end: 0, buf: 0, bufsize: OUTBUFSIZ, fd: 1, flags: 0
^~~~~~
.nextc =
...
-----------------------------------------------------------------------
Fix the issue bu using C99 initializers instead.
This should be safe and should not introduce any compatibility problems
as it is don...
2019 Jan 25
0
[klibc:update-dash] input: Move all input state into parsefile
...read.
- */
-
-MKINIT
-struct parsefile {
- struct parsefile *prev; /* preceding file on stack */
- int linno; /* current line */
- int fd; /* file descriptor (or -1 if string) */
- int nleft; /* number of chars left in this line */
- int lleft; /* number of chars left in this buffer */
- char *nextc; /* next char in buffer */
- char *buf; /* input buffer */
- struct strpush *strpush; /* for pushing strings at this level */
- struct strpush basestrpush; /* so pushing one is fast */
-};
-
-
-int plinno = 1; /* input line number */
-int parsenleft; /* copy of parsefile->nleft */
-MKINIT...
2020 Mar 28
0
[klibc:update-dash] dash: input: Move all input state into parsefile
...read.
- */
-
-MKINIT
-struct parsefile {
- struct parsefile *prev; /* preceding file on stack */
- int linno; /* current line */
- int fd; /* file descriptor (or -1 if string) */
- int nleft; /* number of chars left in this line */
- int lleft; /* number of chars left in this buffer */
- char *nextc; /* next char in buffer */
- char *buf; /* input buffer */
- struct strpush *strpush; /* for pushing strings at this level */
- struct strpush basestrpush; /* so pushing one is fast */
-};
-
-
-int plinno = 1; /* input line number */
-int parsenleft; /* copy of parsefile->nleft */
-MKINIT...
2020 Mar 27
2
[PATCH v2 5/5] Clean up clang warnings
...(quoted & 1)];
quoted >>= 1;
subtype = 0;
goto dostr;
diff --git a/usr/dash/output.c b/usr/dash/output.c
index f62e7eab0b4e..bb7c6ada155d 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -71,27 +71,27 @@
#ifdef USE_GLIBC_STDIO
struct output output = {
- stream: 0, nextc: 0, end: 0, buf: 0, bufsize: 0, fd: 1, flags: 0
+ .stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 1, .flags = 0
};
struct output errout = {
- stream: 0, nextc: 0, end: 0, buf: 0, bufsize: 0, fd: 2, flags: 0
+ .stream = 0, .nextc = 0, .end = 0, .buf = 0, .bufsize = 0, .fd = 2, .fl...
2020 Mar 27
12
[PATCH 0/5] Clang compatibility patches
This is a series of patches for clang compatibility:
- Using flags needed flags and removing unsupported flags.
- Adding support for clang's LLD linker.
- Removing a variety of warnings.
Bill Wendling (3):
[klibc] Kbuild: use "libc.a" with clang
[klibc] Kbuild: Add "-fcommon" for clang builds
[klibc] Clean up clang warnings
Michael Davidson (1):
[klibc] Kbuild:
2012 Jul 02
0
[klibc:master] [OUTPUT] Make outc an inline function
...01 /* error occurred on output */
#ifdef USE_GLIBC_STDIO
-#define outc(c, o) putc((c), (o)->stream)
+static inline void outc(int ch, struct output *file)
+{
+ putc(ch, file->stream);
+}
#define doformat(d, f, a) vfprintf((d)->stream, (f), (a))
#else
-#define outc(c, file) ((file)->nextc == (file)->end ? outcslow((c), (file)) : (*(file)->nextc = (c), (file)->nextc++))
+static inline void outc(int ch, struct output *file)
+{
+ if (file->nextc == file->end)
+ outcslow(ch, file);
+ else {
+ *file->nextc = ch;
+ file->nextc++;
+ }
+}
#endif
#define out1c(c) ou...
2019 Jan 25
0
[klibc:update-dash] input: Allow two consecutive calls to pungetc
...c
index 6223a735..06c08d49 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -102,10 +102,20 @@ RESET {
int
pgetc(void)
{
+ int c;
+
+ if (parsefile->unget)
+ return parsefile->lastc[--parsefile->unget];
+
if (--parsefile->nleft >= 0)
- return (signed char)*parsefile->nextc++;
+ c = (signed char)*parsefile->nextc++;
else
- return preadbuffer();
+ c = preadbuffer();
+
+ parsefile->lastc[1] = parsefile->lastc[0];
+ parsefile->lastc[0] = c;
+
+ return c;
}
@@ -194,7 +204,7 @@ static int preadbuffer(void)
#endif
char savec;
- while (unlikely(par...
2020 Mar 28
0
[klibc:update-dash] dash: input: Allow two consecutive calls to pungetc
...c
index 6223a735..06c08d49 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -102,10 +102,20 @@ RESET {
int
pgetc(void)
{
+ int c;
+
+ if (parsefile->unget)
+ return parsefile->lastc[--parsefile->unget];
+
if (--parsefile->nleft >= 0)
- return (signed char)*parsefile->nextc++;
+ c = (signed char)*parsefile->nextc++;
else
- return preadbuffer();
+ c = preadbuffer();
+
+ parsefile->lastc[1] = parsefile->lastc[0];
+ parsefile->lastc[0] = c;
+
+ return c;
}
@@ -194,7 +204,7 @@ static int preadbuffer(void)
#endif
char savec;
- while (unlikely(par...
2019 Jan 25
0
[klibc:update-dash] [OUTPUT] Add likely tag in outmem
...e changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/output.c b/usr/dash/output.c
index 1b20850a..3e1ae256 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -144,7 +144,7 @@ outmem(const char *p, size_t len, struct output *dest)
size_t nleft;
nleft = dest->end - dest->nextc;
- if (nleft >= len) {
+ if (likely(nleft >= len)) {
buffered:
dest->nextc = mempcpy(dest->nextc, p, len);
return;
2020 Mar 28
0
[klibc:update-dash] dash: [OUTPUT] Add likely tag in outmem
...e changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/output.c b/usr/dash/output.c
index 6618cc33..f9d87a6a 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -144,7 +144,7 @@ outmem(const char *p, size_t len, struct output *dest)
size_t nleft;
nleft = dest->end - dest->nextc;
- if (nleft >= len) {
+ if (likely(nleft >= len)) {
buffered:
dest->nextc = mempcpy(dest->nextc, p, len);
return;
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
...0, f, ap);
+ va_end(ap);
+ return ret;
+}
+
+
#ifndef USE_GLIBC_STDIO
void
doformat(struct output *dest, const char *f, va_list ap)
{
struct stackmark smark;
char *s;
- int len, ret;
- size_t size;
- va_list ap2;
+ int len;
+ int olen;
- va_copy(ap2, ap);
- size = dest->end - dest->nextc;
- len = xvsnprintf(dest->nextc, size, f, ap2);
- va_end(ap2);
- if (len < 0) {
- dest->flags |= OUTPUT_ERR;
- return;
- }
- if (len < size) {
+ setstackmark(&smark);
+ s = dest->nextc;
+ olen = dest->end - dest->nextc;
+ len = xvasprintf(&s, olen, f, ap);
+ if (likel...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
...0, f, ap);
+ va_end(ap);
+ return ret;
+}
+
+
#ifndef USE_GLIBC_STDIO
void
doformat(struct output *dest, const char *f, va_list ap)
{
struct stackmark smark;
char *s;
- int len, ret;
- size_t size;
- va_list ap2;
+ int len;
+ int olen;
- va_copy(ap2, ap);
- size = dest->end - dest->nextc;
- len = xvsnprintf(dest->nextc, size, f, ap2);
- va_end(ap2);
- if (len < 0) {
- dest->flags |= OUTPUT_ERR;
- return;
- }
- if (len < size) {
+ setstackmark(&smark);
+ s = dest->nextc;
+ olen = dest->end - dest->nextc;
+ len = xvasprintf(&s, olen, f, ap);
+ if (likel...