/* makes a constant ist from a constant string, for use in array declarations */
#define IST(str) { .ptr = str "", .len = (sizeof str "") - 1 }
+/* IST_NULL is equivalent to an `ist` with `.ptr = NULL` and `.len = 0` */
+#define IST_NULL ((const struct ist){ .ptr = 0, .len = 0 })
+
/* makes an ist from a regular zero terminated string. Null has length 0.
* Constants are detected and replaced with constant initializers. Other values
* are measured by hand without strlen() as it's much cheaper and inlinable on
}
return ist2(ret.ptr - 1, ret.len + 1);
}
- return ist2(NULL, 0);
+ return IST_NULL;
}
/*
value = ist2(vtrash, vlen);
}
- name = ist2(NULL, 0);
+ name = IST_NULL;
if (!must_index)
name.len = hpack_idx_to_phdr(idx);
}
/* put an end marker */
- list[ret].n = list[ret].v = ist2(NULL, 0);
+ list[ret].n = list[ret].v = IST_NULL;
ret++;
leave:
return ist2(start, end - start);
not_found:
- return ist2(NULL, 0);
+ return IST_NULL;
}
/* Parse the URI from the given transaction (which is assumed to be in request
return ist2(ptr, end - ptr);
not_found:
- return ist2(NULL, 0);
+ return IST_NULL;
}
/*
blk = htx_remove_blk(htx, blk);
if (blk || htx_is_empty(htx)) {
ctx->blk = blk;
- ctx->value = ist2(NULL, 0);
+ ctx->value = IST_NULL;
ctx->lws_before = ctx->lws_after = 0;
}
else {