Logo
Explore Help
Sign In
fluencelabs/musl
1
0
Fork 0
You've already forked musl
mirror of https://github.com/fluencelabs/musl synced 2025-06-08 04:21:39 +00:00
Code Issues Projects Releases Wiki Activity
musl/src/internal/shgetc.h

26 lines
394 B
C
Raw Normal View History

add "scan helper getc" and rework strtod, etc. to use it the immediate benefit is a significant debloating of the float parsing code by moving the responsibility for keeping track of the number of characters read to a different module. by linking shgetc with the stdio buffer logic, counting logic is defered to buffer refill time, keeping the calls to shgetc fast and light. in the future, shgetc will also be useful for integrating the new float code with scanf, which needs to not only count the characters consumed, but also limit the number of characters read based on field width specifiers. shgetc may also become a useful tool for simplifying the integer parsing code.
2012-04-10 21:47:37 -04:00
#include "stdio_impl.h"
void __shlim(FILE *, off_t);
int __shgetc(FILE *);
static inline off_t shcnt(FILE *f)
{
return f->shcnt + (f->rpos - f->rend);
}
static inline void shlim(FILE *f, off_t lim)
{
__shlim(f, lim);
}
static inline int shgetc(FILE *f)
{
if (f->rpos < f->shend) return *f->rpos++;
return __shgetc(f);
}
static inline void shunget(FILE *f)
{
if (f->rend) f->rpos--;
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 62ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API