chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fcb1a75
)
hexdcoct: dump to stdout if FILE* is specified as NULL
author
Lennart Poettering
<lennart@poettering.net>
Fri, 27 Oct 2017 09:14:27 +0000
(11:14 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 27 Oct 2017 09:14:27 +0000
(11:14 +0200)
We do a logic like that at various other places, let's do it here too,
to make this as little surprising as possible.
src/basic/hexdecoct.c
patch
|
blob
|
history
diff --git
a/src/basic/hexdecoct.c
b/src/basic/hexdecoct.c
index dec5552a77da22f01516e9ba1ab4a3afc4d20167..b61b032d9921788529e9aad8151598634dfcb561 100644
(file)
--- a/
src/basic/hexdecoct.c
+++ b/
src/basic/hexdecoct.c
@@
-737,7
+737,10
@@
void hexdump(FILE *f, const void *p, size_t s) {
const uint8_t *b = p;
unsigned n = 0;
- assert(s == 0 || b);
+ assert(b || s == 0);
+
+ if (!f)
+ f = stdout;
while (s > 0) {
size_t i;