runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 78a77163d5673d93d86b4f2792a4c85506d37442
parent b935fa50ba57596ff498ea2cb9f5436ae3cb1b5e
Author: Morel BĂ©renger <berengermorel76@gmail.com>
Date:   Sun,  6 Oct 2024 21:14:02 +0200

move buffer macros (except INIT) in using files

Diffstat:
Msrc/buffer.h | 15---------------
Msrc/svlogd.c | 15+++++++++++++++
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/buffer.h b/src/buffer.h @@ -26,12 +26,6 @@ extern int buffer_puts(buffer *,const char *); extern int buffer_putsalign(buffer *,const char *); extern int buffer_putsflush(buffer *,const char *); -#define buffer_PUTC(s,c) \ - ( ((s)->n != (s)->p) \ - ? ( (s)->x[(s)->p++] = (c), 0 ) \ - : buffer_put((s),&(c),1) \ - ) - extern int buffer_get(buffer *,char *,unsigned int); extern int buffer_bget(buffer *,char *,unsigned int); extern int buffer_feed(buffer *); @@ -39,15 +33,6 @@ extern int buffer_feed(buffer *); extern char *buffer_peek(buffer *); extern void buffer_seek(buffer *,unsigned int); -#define buffer_PEEK(s) ( (s)->x + (s)->n ) -#define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) ) - -#define buffer_GETC(s,c) \ - ( ((s)->p > 0) \ - ? ( *(c) = (s)->x[(s)->n], buffer_SEEK((s),1), 1 ) \ - : buffer_get((s),(c),1) \ - ) - extern int buffer_copy(buffer *,buffer *); extern int buffer_unixread(int,char *,unsigned int); diff --git a/src/svlogd.c b/src/svlogd.c @@ -681,6 +681,21 @@ static void logmatch(struct logdir *ld) i +=byte_chr(&ld->inst.s[i], ld->inst.len -i, 0); } } + +#define buffer_PUTC(s,c) \ + ( ((s)->n != (s)->p) \ + ? ( (s)->x[(s)->p++] = (c), 0 ) \ + : buffer_put((s),&(c),1) \ + ) + +#define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) ) + +#define buffer_GETC(s,c) \ + ( ((s)->p > 0) \ + ? ( *(c) = (s)->x[(s)->n], buffer_SEEK((s),1), 1 ) \ + : buffer_get((s),(c),1) \ + ) + int main(int argc, const char **argv) { int i;