`isttest` returns whether the `.ptr` is non-null.
return (struct ist){ .ptr = (char *)ptr, .len = len };
}
+/* returns the result of `ist.ptr != NULL` */
+static inline int isttest(const struct ist ist)
+{
+ return ist.ptr != NULL;
+}
+
/* This function MODIFIES the string to add a zero AFTER the end, and returns
* the start pointer. The purpose is to use it on strings extracted by parsers
* from larger strings cut with delimiters that are not important and can be
trash.data = res - trash.area;
/* Do we have a custom reason format string? */
- if (reason.ptr == NULL) {
+ if (!isttest(reason)) {
const char *str = http_get_reason(status);
reason = ist2(str, strlen(str));
}