MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xo_set_version_h

Function xo_set_version_h

tools/libxo/libxo/libxo.c:8258–8287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8256}
8257
8258void
8259xo_set_version_h (xo_handle_t *xop, const char *version)
8260{
8261 xop = xo_default(xop);
8262
8263 if (version == NULL || strchr(version, '"') != NULL)
8264 return;
8265
8266 if (!xo_style_is_encoding(xop))
8267 return;
8268
8269 switch (xo_style(xop)) {
8270 case XO_STYLE_XML:
8271 /* For XML, we record this as an attribute for the first tag */
8272 xo_attr_h(xop, "version", "%s", version);
8273 break;
8274
8275 case XO_STYLE_JSON:
8276 /*
8277 * For JSON, we record the version string in our handle, and emit
8278 * it in xo_emit_top.
8279 */
8280 xop->xo_version = xo_strndup(version, -1);
8281 break;
8282
8283 case XO_STYLE_ENCODER:
8284 xo_encoder_handle(xop, XO_OP_VERSION, NULL, version, 0);
8285 break;
8286 }
8287}
8288
8289/*
8290 * Set the version number for the API content being carried through

Callers 1

xo_set_versionFunction · 0.85

Calls 7

xo_defaultFunction · 0.85
strchrFunction · 0.85
xo_style_is_encodingFunction · 0.85
xo_styleFunction · 0.85
xo_attr_hFunction · 0.85
xo_strndupFunction · 0.85
xo_encoder_handleFunction · 0.85

Tested by

no test coverage detected