ref: 61e1bbc29155917b2f2a27d5286428cbf9c315fb
parent: b4c113c4fc16ea6c3b2adacc60f096d2b7c8decc
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Oct 22 14:48:04 EDT 2024
ios: remove unused functions
--- a/ios.c
+++ b/ios.c
@@ -264,12 +264,6 @@
}
size_t
-ios_readall(ios_t *s, char *dest, size_t n)
-{
- return _ios_read(s, dest, n, 1);
-}
-
-size_t
ios_readprep(ios_t *s, size_t n)
{
if(s->state == bst_wr && s->bm != bm_mem){
@@ -850,29 +844,6 @@
}
int
-ios_ungetc(int c, ios_t *s)
-{
- if(s->state == bst_wr)
- return IOS_EOF;
- if(c == '\n')
- s->lineno--;
- if(s->bpos > 0){
- s->bpos--;
- if(s->buf[s->bpos] != (char)c)
- s->buf[s->bpos] = (char)c;
- s->_eof = 0;
- return c;
- }
- if(s->size == s->maxsize && _buf_realloc(s, s->maxsize*2) == nil)
- return IOS_EOF;
- memmove(s->buf + 1, s->buf, s->size);
- s->buf[0] = (char)c;
- s->size++;
- s->_eof = 0;
- return c;
-}
-
-int
ios_getutf8(ios_t *s, uint32_t *pwc)
{
int c;
@@ -951,16 +922,6 @@
{
if(s->state == bst_rd)
s->bpos = s->size;
-}
-
-char *
-ios_readline(ios_t *s)
-{
- ios_t dest;
- ios_mem(&dest, 0);
- ios_copyuntil(&dest, s, '\n');
- size_t n;
- return ios_takebuf(&dest, &n);
}
int
--- a/ios.h
+++ b/ios.h
@@ -62,7 +62,6 @@
/* low-level interface functions */
size_t ios_read(ios_t *s, char *dest, size_t n);
-size_t ios_readall(ios_t *s, char *dest, size_t n);
size_t ios_write(ios_t *s, const char *data, size_t n);
off_t ios_seek(ios_t *s, off_t pos); // absolute seek
off_t ios_seek_end(ios_t *s);
@@ -82,9 +81,6 @@
size_t ios_copyuntil(ios_t *to, ios_t *from, char delim);
// ensure at least n bytes are buffered if possible. returns # available.
size_t ios_readprep(ios_t *from, size_t n);
-//void ios_lock(ios_t *s);
-//int ios_trylock(ios_t *s);
-//int ios_unlock(ios_t *s);
/* stream creation */
ios_t *ios_file(ios_t *s, char *fname, int rd, int wr, int create, int trunc);
@@ -99,10 +95,7 @@
void ios_init_stdstreams(void);
/* high-level functions - output */
-int ios_putnum(ios_t *s, char *data, uint32_t type);
-int ios_putint(ios_t *s, int n);
int ios_pututf8(ios_t *s, uint32_t wc);
-int ios_putstringz(ios_t *s, char *str, int do_write_nulterm);
int ios_printf(ios_t *s, const char *format, ...);
int ios_vprintf(ios_t *s, const char *format, va_list args);
@@ -109,31 +102,17 @@
void hexdump(ios_t *dest, const char *buffer, size_t len, size_t startoffs);
/* high-level stream functions - input */
-int ios_getnum(ios_t *s, char *data, uint32_t type);
int ios_getutf8(ios_t *s, uint32_t *pwc);
int ios_peekutf8(ios_t *s, uint32_t *pwc);
-int ios_ungetutf8(ios_t *s, uint32_t wc);
-int ios_getstringz(ios_t *dest, ios_t *src);
-int ios_getstringn(ios_t *dest, ios_t *src, size_t nchars);
-int ios_getline(ios_t *s, char **pbuf, size_t *psz);
-char *ios_readline(ios_t *s);
// discard data buffered for reading
void ios_purge(ios_t *s);
-// seek by utf8 sequence increments
-int ios_nextutf8(ios_t *s);
-int ios_prevutf8(ios_t *s);
-
/* stdio-style functions */
#define IOS_EOF (-1)
int ios_putc(int c, ios_t *s);
-//wint_t ios_putwc(ios_t *s, wchar_t wc);
int ios_getc(ios_t *s);
int ios_peekc(ios_t *s);
-//wint_t ios_getwc(ios_t *s);
-int ios_ungetc(int c, ios_t *s);
-//wint_t ios_ungetwc(ios_t *s, wint_t wc);
#define ios_puts(str, s) ios_write(s, str, strlen(str))
/*