static void membuffer_write_std_tag(struct membuffer *buf, const char *name,
const char *value)
{
- uint32_t flags = 1;
-
- /* special check for compilation flag */
- if (strcmp(name, "cpil") == 0) {
- flags = 21;
- }
-
- membuffer_write_int32(buf,
- 8 /*atom header */ + 8 /*data atom header */ +
- 8 /*flags + reserved */ + strlen(value));
+ uint32_t len = strlen(value);
+ membuffer_write_int32(buf, 8 /* atom header */
+ + 8 /* data atom header */
+ + 8 /* flags + reserved */
+ + len);
membuffer_write_atom_name(buf, name);
- membuffer_write_int32(buf,
- 8 /*data atom header */ +
- 8 /*flags + reserved */ + strlen(value));
+ membuffer_write_int32(buf, 8 /* data atom header */
+ + 8 /* flags + reserved */
+ + len);
membuffer_write_atom_name(buf, "data");
- membuffer_write_int32(buf, flags); //flags
- membuffer_write_int32(buf, 0); //reserved
- membuffer_write(buf, value, strlen(value));
+ membuffer_write_int32(buf, 1); /* flags */
+ membuffer_write_int32(buf, 0); /* reserved */
+ membuffer_write(buf, value, len);
}
static unsigned membuffer_error(const struct membuffer *buf)