mailing list of musl libc
 help / color / mirror / code / Atom feed
a4dd6d6aa85854c2a6f5a5adfac7d9ea1d98b035 blob 1313 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
#include "stdio_impl.h"

/* Scan helper "stdio" functions for use by scanf-family and strto*-family
 * functions. These accept either avalid stdio FILE, or a minimal pseduo
 * FILE whose buffer pointers point into a null-terminated string. In the
 * latter case, the sh_fromstring macro should be used to setup the FILE;
 * the rest of the structure can be left uninitialized.
 *
 * To begin using these functions, shlim must first be called on the FILE
 * to set a field width limit, or 0 for no limit. For string pseudo-FILEs,
 * a nonzero limit is not valid and produces undefined behavior. After that,
 * shgetc, shunget, and shcnt are valid as long as no other stdio functions
 * are called on the stream. shunget can only be called once without an
 * intervening successful shgetc on real stdio FILEs. It can be called
 * multiple times, up to the number of successful shgetc calls, on a
 * string pseudo-FILE. */

hidden void __shlim(FILE *, off_t);
hidden int __shgetc(FILE *);

#define sh_fromstring(f, s) \
	((f)->buf = (f)->rpos = (void *)(s), (f)->rend = (void*)-1)

#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->buf))
#define shlim(f, lim) __shlim((f), (lim))
#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : __shgetc(f))
#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0)
debug log:

solving a4dd6d6 ...
found a4dd6d6 in https://inbox.vuxu.org/musl/20180914203953.GO1878@brightrain.aerifal.cx/
found 210f646 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 210f6468581bf21afecbbb1b3f4d2fa4e8794f30	src/internal/shgetc.h

applying [1/1] https://inbox.vuxu.org/musl/20180914203953.GO1878@brightrain.aerifal.cx/
diff --git a/src/internal/shgetc.h b/src/internal/shgetc.h
index 210f646..a4dd6d6 100644

Checking patch src/internal/shgetc.h...
Applied patch src/internal/shgetc.h cleanly.

index at:
100644 a4dd6d6aa85854c2a6f5a5adfac7d9ea1d98b035	src/internal/shgetc.h

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).