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

Function xo_set_gettext_domain

tools/libxo/libxo/libxo.c:4628–4661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4626}
4627
4628static void
4629xo_set_gettext_domain (xo_handle_t *xop, xo_field_info_t *xfip,
4630 const char *str, ssize_t len)
4631{
4632 const char *fmt = xfip->xfi_format;
4633 ssize_t flen = xfip->xfi_flen;
4634
4635 /* Start by discarding previous domain */
4636 if (xop->xo_gt_domain) {
4637 xo_free(xop->xo_gt_domain);
4638 xop->xo_gt_domain = NULL;
4639 }
4640
4641 /* An empty {G:} means no domainname */
4642 if (len == 0 && flen == 0)
4643 return;
4644
4645 ssize_t start_offset = -1;
4646 if (len == 0 && flen != 0) {
4647 /* Need to do format the data to get the domainname from args */
4648 start_offset = xop->xo_data.xb_curp - xop->xo_data.xb_bufp;
4649 xo_do_format_field(xop, NULL, fmt, flen, 0);
4650
4651 ssize_t end_offset = xop->xo_data.xb_curp - xop->xo_data.xb_bufp;
4652 len = end_offset - start_offset;
4653 str = xop->xo_data.xb_bufp + start_offset;
4654 }
4655
4656 xop->xo_gt_domain = xo_strndup(str, len);
4657
4658 /* Reset the current buffer point to avoid emitting the name as output */
4659 if (start_offset >= 0)
4660 xop->xo_data.xb_curp = xop->xo_data.xb_bufp + start_offset;
4661}
4662
4663static void
4664xo_format_content (xo_handle_t *xop, const char *class_name,

Callers 1

xo_do_emit_fieldsFunction · 0.85

Calls 2

xo_do_format_fieldFunction · 0.85
xo_strndupFunction · 0.85

Tested by

no test coverage detected