osmo_quote_str_c()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Pau Espin Pedrol pespin at sysmocom.de
Fri Apr 12 13:01:15 UTC 2019


Hi Neels,

I don't quite get why is 32 used there. Also documentation and 
implementation look wrong to me:
* doc talks about static buffer. That makes no sense to me, line should 
be removed.
* Case of in_len=-1 is not correctly handled there.

I'd change it to:

char *osmo_quote_str_c(const void *ctx, const char *str, int in_len)
{
	size_t len = in_len == -1 ? strlen(str) : in_len;
	len += 2;
	char *buf = talloc_size(ctx, len);
	if (!buf)
		return NULL;
	return osmo_quote_str_buf2(buf, len, str, in_len);
}

-- 
- Pau Espin Pedrol <pespin at sysmocom.de>         http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Director: Harald Welte



More information about the OpenBSC mailing list