diff options
| author | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
|---|---|---|
| committer | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
| commit | b786f20bbab5a59046aa78a2c6c2a11536497202 (patch) | |
| tree | 0851ecdec889eb9b7ba3751cc04d4f0b474e4a9e /liblogfs/gn.c | |
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'liblogfs/gn.c')
| -rw-r--r-- | liblogfs/gn.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/liblogfs/gn.c b/liblogfs/gn.c new file mode 100644 index 0000000..005bcde --- /dev/null +++ b/liblogfs/gn.c @@ -0,0 +1,26 @@ +#include "logfsos.h" +#include "logfs.h" +#include "fcall.h" +#include "local.h" + +int +logfsgn(uchar **pp, uchar *mep, char **v) +{ + uchar *p = *pp; + int l; + if(p + BIT16SZ > mep) + return 0; + l = GBIT16(p); p += BIT16SZ; + if(p + l > mep) + return 0; + *pp = p + l; + if(l == 0) { + *v = 0; + return 1; + } + *v = (char *)(p - 1); + memmove(p - 1, p, l); + p[l - 1] = 0; + return 1; +} + |
