summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2024-01-20 20:07:53 +0100
committerpgen <p.gen.progs@gmail.com>2024-01-20 20:09:00 +0100
commit0ed7710955e3dfe99b9447b33993488d0d90645c (patch)
tree743a312ba5df79fc25944c8040dc878424a2383f
parent9626f39277511aa59b0324113989445c312a9148 (diff)
[utils.c] Comment the hexdump function
Fix also a compiler warning.
-rw-r--r--utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index bbc1b1e..010d16a 100644
--- a/utils.c
+++ b/utils.c
@@ -11,6 +11,7 @@
/* ******************************** */
#include "config.h"
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
@@ -399,12 +400,20 @@ strprint(char const *s)
}
}
- if (p - new > l)
+ if (p - new > (ptrdiff_t)l)
new = xrealloc(new, p - new + 1);
return new;
}
+/* =============================================== */
+/* Hexadecimal dump of part of a buffer to a file. */
+/* */
+/* buf : buffer to dump. */
+/* fp : file to dump to. */
+/* prefix: string to be printed before each line. */
+/* size : length of the buffer to consider. */
+/* =============================================== */
void
hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
{