Skip to content

Instantly share code, notes, and snippets.

View ehetherington's full-sized avatar

Edward Hetherington ehetherington

View GitHub Profile
@ehetherington
ehetherington / buf_splitter.c
Created August 14, 2020 03:58
Parse lines from a string
/**
* @file buf_splitter.c
*
* @brief Split a string into a series of records.
*
* @details Parse lines from a string in modifiable memory. A control structure
* is initialized first. Then substrings separated by the specified
* record-separator are returned by repeated calls to bs_next(). The end of
* available strings is indicated by bs_next() returning NULL.
*
@ehetherington
ehetherington / hexformat.c
Last active August 17, 2020 20:07
format a memory buffer to a hex representation in a buffer allocated by malloc()
/*
* (C) 2020 Edward Hetherington
* This code is licensed under MIT license (see LICENSE in top dir for details)
*/
/**
* @file hexformat.c
* @brief Format a memory buffer to a hex representation in another
* buffer.
* @details The output includes a hex offset relative to the beginning of