diff options
Diffstat (limited to '')
-rw-r--r-- | libsimple/mem.h | 18 | ||||
-rw-r--r-- | man/libsimple_memelem.3 | 4 | ||||
-rw-r--r-- | man/libsimple_memends.3 | 78 | ||||
-rw-r--r-- | man/libsimple_memmem.3 | 2 | ||||
-rw-r--r-- | man/libsimple_memrchr.3 | 2 | ||||
-rw-r--r-- | man/libsimple_memrelem.3 | 4 | ||||
-rw-r--r-- | man/libsimple_memrmem.3 | 2 | ||||
-rw-r--r-- | man/libsimple_memstarts.3 | 76 | ||||
-rw-r--r-- | man/libsimple_rawmemchr.3 | 2 |
9 files changed, 180 insertions, 8 deletions
diff --git a/libsimple/mem.h b/libsimple/mem.h index bd20a49..ba5d0fb 100644 --- a/libsimple/mem.h +++ b/libsimple/mem.h @@ -133,6 +133,15 @@ void *libsimple_memrelem(const void *, size_t, const void *, size_t); #endif +/** + * Checks the beginning of an array of bytes + * + * @param s The array of bytes to check + * @param n The length of `s` + * @param t The desired beginning of `s` + * @param m The length of `t` + * @return 1 if `s` begins with `t`, 0 otherwise + */ _LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__))) int libsimple_memstarts(const void *, size_t, const void *, size_t); #ifndef memstarts @@ -140,6 +149,15 @@ int libsimple_memstarts(const void *, size_t, const void *, size_t); #endif +/** + * Checks the end of an array of bytes + * + * @param s The array of bytes to check + * @param n The length of `s` + * @param t The desired ending of `s` + * @param m The length of `t` + * @return 1 if `s` ends with `t`, 0 otherwise + */ _LIBSIMPLE_GCC_ONLY(__attribute__((__pure__, __warn_unused_result__))) int libsimple_memends(const void *, size_t, const void *, size_t); #ifndef memends diff --git a/man/libsimple_memelem.3 b/man/libsimple_memelem.3 index be182c3..5e54171 100644 --- a/man/libsimple_memelem.3 +++ b/man/libsimple_memelem.3 @@ -1,11 +1,11 @@ .TH LIBSIMPLE_MEMELEM 3 2018-10-20 libsimple .SH NAME -libsimple_memelem \- find byte string in memory +libsimple_memelem \- find aligned byte string in memory .SH SYNOPSIS .nf #include <libsimple.h> -void *libsimple_memelem(const void *haystack, size_t nhaystack, const void *needle, size_t nneedle); +void *libsimple_memelem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, const void *\fIneedle\fP, size_t \fInneedle\fP); #ifndef memelem # define memelem libsimple_memelem diff --git a/man/libsimple_memends.3 b/man/libsimple_memends.3 new file mode 100644 index 0000000..114cedb --- /dev/null +++ b/man/libsimple_memends.3 @@ -0,0 +1,78 @@ +.TH LIBSIMPLE_MEMENDS 3 2018-10-20 libsimple +.SH NAME +libsimple_memends \- checks end of memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +void *libsimple_memends(const void *\fIs\fP, size_t \fIn\fP, const void *\fIt\fP, size_t \fIm\fP); + +#ifndef memends +# define memends libsimple_memends +#endif +.fi + +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memends () +function checks whether the +.I n +is at least as great as +.I m +and that the +.I m +last bytes of +.IR s , +with the size +.IR n , +is the same as the +.I m +first bytes of +.IR t . +.SH RETURN VALUE +The +.BR libsimple_memends () +function returns 1 if +.I s +ends with +.IR t , +otherwise it returns 0. +.SH ERRORS +The +.BR libsimple_memends () +function cannot fail. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_memends () +T} Thread safety MT-Safe +T{ +.BR libsimple_memends () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memends () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None. +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_memstarts (3), +.BR libsimple_memrmem (3) diff --git a/man/libsimple_memmem.3 b/man/libsimple_memmem.3 index 6701b46..18dec5d 100644 --- a/man/libsimple_memmem.3 +++ b/man/libsimple_memmem.3 @@ -5,7 +5,7 @@ libsimple_memmem \- find byte string in memory .nf #include <libsimple.h> -void *libsimple_memmem(const void *haystack, size_t nhaystack, const void *needle, size_t nneedle); +void *libsimple_memmem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, const void *\fIneedle\fP, size_t \fInneedle\fP); #ifndef memmem # define memmem libsimple_memmem diff --git a/man/libsimple_memrchr.3 b/man/libsimple_memrchr.3 index 4c93b0a..b0a01a7 100644 --- a/man/libsimple_memrchr.3 +++ b/man/libsimple_memrchr.3 @@ -5,7 +5,7 @@ libsimple_memrchr \- find byte in memory .nf #include <libsimple.h> -void *libsimple_memrchr(const void *s, int c, size_t n); +void *libsimple_memrchr(const void *\fIs\fP, int \fIc\fP, size_t \fIn\fP); #ifndef memrchr # define memrchr libsimple_memrchr diff --git a/man/libsimple_memrelem.3 b/man/libsimple_memrelem.3 index 77f5293..66f7bd8 100644 --- a/man/libsimple_memrelem.3 +++ b/man/libsimple_memrelem.3 @@ -1,11 +1,11 @@ .TH LIBSIMPLE_MEMRELEM 3 2018-10-20 libsimple .SH NAME -libsimple_memrelem \- find byte string in memory +libsimple_memrelem \- find aligned byte string in memory .SH SYNOPSIS .nf #include <libsimple.h> -void *libsimple_memrelem(const void *haystack, size_t nhaystack, const void *needle, size_t nneedle); +void *libsimple_memrelem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, const void *\fIneedle\fP, size_t \fInneedle\fP); #ifndef memrelem # define memrelem libsimple_memrelem diff --git a/man/libsimple_memrmem.3 b/man/libsimple_memrmem.3 index c9daf17..aae6572 100644 --- a/man/libsimple_memrmem.3 +++ b/man/libsimple_memrmem.3 @@ -5,7 +5,7 @@ libsimple_memrmem \- find byte string in memory .nf #include <libsimple.h> -void *libsimple_memrmem(const void *haystack, size_t nhaystack, const void *needle, size_t nneedle); +void *libsimple_memrmem(const void *\fIhaystack\fP, size_t \fInhaystack\fP, const void *\fIneedle\fP, size_t \fInneedle\fP); #ifndef memrmem # define memrmem libsimple_memrmem diff --git a/man/libsimple_memstarts.3 b/man/libsimple_memstarts.3 new file mode 100644 index 0000000..e5e183b --- /dev/null +++ b/man/libsimple_memstarts.3 @@ -0,0 +1,76 @@ +.TH LIBSIMPLE_MEMSTARTS 3 2018-10-20 libsimple +.SH NAME +libsimple_memstarts \- checks beginning of memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +void *libsimple_memstarts(const void *\fIs\fP, size_t \fIn\fP, const void *\fIt\fP, size_t \fIm\fP); + +#ifndef memstarts +# define memstarts libsimple_memstarts +#endif +.fi + +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_memstarts () +function checks whether the +.I n +is at least as great as +.I m +and that the +.I m +first bytes of +.I s +is the same as the +.I m +first bytes of +.IR t . +.SH RETURN VALUE +The +.BR libsimple_memstarts () +function returns 1 if +.I s +begins with +.IR t , +otherwise it returns 0. +.SH ERRORS +The +.BR libsimple_memstarts () +function cannot fail. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_memstarts () +T} Thread safety MT-Safe +T{ +.BR libsimple_memstarts () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_memstarts () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None. +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_memends (3), +.BR libsimple_memmem (3) diff --git a/man/libsimple_rawmemchr.3 b/man/libsimple_rawmemchr.3 index 347ab4c..2991b1f 100644 --- a/man/libsimple_rawmemchr.3 +++ b/man/libsimple_rawmemchr.3 @@ -5,7 +5,7 @@ libsimple_rawmemchr \- find byte in memory .nf #include <libsimple.h> -void *libsimple_rawmemchr(const void *s, int c); +void *libsimple_rawmemchr(const void *\fIs\fP, int \fIc\fP); #ifndef rawmemchr # define rawmemchr libsimple_rawmemchr |