mirror of
https://github.com/tailix/libkernaux.git
synced 2025-02-17 15:45:32 -05:00
Main: src/ntoa.h: Protect caller from invalid state in case of future assertions
This commit is contained in:
parent
c1e7f5e20b
commit
361c60e719
2 changed files with 4 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
* include/kernaux/ntoa.h: Functions "kernaux_[u|i]toa16" put default prefix
|
* include/kernaux/ntoa.h: Functions "kernaux_[u|i]toa16" put default prefix
|
||||||
* include/kernaux/ntoa.h: Add octal functions "kernaux_[u|i]toa8"
|
* include/kernaux/ntoa.h: Add octal functions "kernaux_[u|i]toa8"
|
||||||
* include/kernaux/ntoa.h: Add binary functions "kernaux_[u|i]toa2"
|
* include/kernaux/ntoa.h: Add binary functions "kernaux_[u|i]toa2"
|
||||||
|
* src/ntoa.h: Protect caller from invalid state in case of future assertions
|
||||||
|
|
||||||
2022-05-28 Alex Kotov <kotovalexarian@gmail.com>
|
2022-05-28 Alex Kotov <kotovalexarian@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ char *kernaux_utoa(uint64_t value, char *buffer, int base, const char *prefix)
|
||||||
{
|
{
|
||||||
KERNAUX_NOTNULL_RETVAL(buffer, NULL);
|
KERNAUX_NOTNULL_RETVAL(buffer, NULL);
|
||||||
|
|
||||||
|
// Protect caller from invalid state in case of future assertions
|
||||||
|
*buffer = '\0';
|
||||||
|
|
||||||
switch (base) {
|
switch (base) {
|
||||||
case 'b': case 'B': base = 2; break;
|
case 'b': case 'B': base = 2; break;
|
||||||
case 'o': case 'O': base = 8; break;
|
case 'o': case 'O': base = 8; break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue