read = fread(sbuff->end, 1, available, fctx->file);
sbuff->end += read; /* Advance end, which increases fr_sbuff_remaining() */
- *sbuff->end = '\0'; /* Terminate sbuff */
/** Check for errors
*/
#include <freeradius-devel/util/acutest.h>
#include <freeradius-devel/util/acutest_helpers.h>
-#include "sbuff.c"
+#include "sbuff.h"
//#include <gperftools/profiler.h>
FILE *fp;
char buff[16];
char fbuff[] = " xyzzy";
+ char *post_ws;
TEST_CASE("Initialization");
fp = fmemopen(fbuff, sizeof(fbuff) - 1, "r");
TEST_CASE("Advance past whitespace, which will require shift/extend");
TEST_CHECK_LEN(sizeof(fbuff) - 6, fr_sbuff_adv_past_whitespace(&sbuff, SIZE_MAX));
TEST_CASE("Verify that we passed all and only whitespace");
- TEST_CHECK_STRCMP(sbuff.p, "xyzzy");
+ (void) fr_sbuff_out_abstrncpy(NULL, &post_ws, &sbuff, 24);
+ TEST_CHECK_STRCMP(post_ws, "xyzzy");
+ talloc_free(post_ws);
fclose(fp);
}