aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-02utils: Greatly improve performance of osmo_hexdump routinesNils O. SelÄsdal1-5/+13
In the osmo-bts and libosmo-abis code the hexdump routine is used for every incoming/outgoing packet (including voice frames) and the usage of snprintf showed up inside profiles. There is a semantic change when more than 4096 characters are used. The code will now truncate at byte boundaries (and not nibbles). Code: static const int lengths[] = { 23, 1000, 52 }; char buf[4096]; int i; for (i = 0; i < 30000; ++i) char *res = osmo_hexdump(buf, lengths[i & 3]); Results: before: after: real 0m3.233s real 0m0.085s user 0m3.212s user 0m0.084s sys 0m0.000s sys 0m0.000s
2013-07-04get_value_string: Null terminate after the call to snprintfHolger Hans Peter Freyther1-0/+1
It is impossible that the snprintf will fill the entire namebuf but just follow the idiom to make sure it is null terminated. Related: Coverity CID 1040676
2013-01-11add some missing doxygen annotation for libosmocore functionsHarald Welte1-1/+9
2012-04-18doc: Fix the Doxygen section endingsSylvain Munaut1-1/+1
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-19utils: Fix alias to weak alias to allow OSX compilationSylvain Munaut1-1/+1
Using a weak alias works just as good AFAICT. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-11core/utils: Add a symbol alias for a previous typo for compatibilitySylvain Munaut1-0/+4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-10utils: Fix a bad double osmo_ prefix for osmo_hexdump_nospcSylvain Munaut1-1/+1
Hopefully no project where using them it seems Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-08-17doxygen: add doxygen module 'utils'Harald Welte1-0/+51
2011-07-15osmo_hexdump: Fix segfault when input is too long.Holger Hans Peter Freyther1-0/+2
In snprinftf the size is a size_t (unsigned) in case we want to write more than we have available, len_remain will be < 0. This was spotted while removing hexdump from simtrace and comparing it to our implementation. int snprintf(char *str, size_t size, const char *format, ...);
2011-05-07utils: use namespace prefix osmo_*Pablo Neira Ayuso1-9/+9
Summary of changes: s/bcd2char/osmo_bcd2char/g s/char2bcd/osmo_char2bcd/g s/hexparse/osmo_hexparse/g s/hexdump/osmo_hexdump/g s/hexdump_nospc/osmo_hexdump_nospc/g s/ubit_dump/osmo_ubit_dump/g s/static_assert/osmo_static_assert/g
2011-03-23include: reorganize headers file to include/osmocom/[gsm|core]0.2.0Pablo Neira Ayuso1-1/+1
This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-02-18LOGGING: configure logging from the vtyHarald Welte1-0/+22
We can now configure logging to (multiple) files, stderr and syslog from the vty command line in a persistent way (config file)
2011-02-08[utils] introduce ubit_dump to dump buffers of unpacked bitsHarald Welte1-1/+1
2011-02-08[utils] add 'bitdump' function for bitfieldsHarald Welte1-0/+30
2010-11-19utils: Fix typo. It is ascii.Holger Hans Peter Freyther1-1/+1
2010-07-30add new hexdump_nospc() function0.1.15Harald Welte1-2/+12
2010-07-30move hexdump() from logging.c to utils.cHarald Welte1-0/+19
2010-07-30Import 'hexparse' function from OpenBSC0.1.14Harald Welte1-0/+27
2010-03-25get_value_string(): return "unknown 0x..." instead of "unknown"Harald Welte1-1/+5
2010-03-04import bcd2char() and char2bcd() from OpenBSCHarald Welte1-0/+14
2010-03-01Import value_string utilities and some RSL stuff from OpenBSCHarald Welte1-0/+32