]> The Tcpdump Group git mirrors - tcpdump/commitdiff
amend some comments in util-print.c
authorDenis Ovsienko <[email protected]>
Sat, 5 Sep 2015 18:39:20 +0000 (19:39 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 5 Sep 2015 20:11:53 +0000 (21:11 +0100)
When I needed to print a string and didn't remember which of the three
functions fn_print(), fn_printn() and fn_printzp() was the right one
for the data, every time it would end up in reading through all of them
and forgetting the difference shortly after the commit.

Just having it explained in the comments should work better.

util-print.c

index cfdcfe8c063ee59d3af366729bf4a3d177ff32a3..4cefc7568c8f7522409f005780cbf4cb32eaa589 100644 (file)
@@ -69,6 +69,7 @@ int32_t thiszone;             /* seconds offset from gmt to local time */
  * Print out a null-terminated filename (or other ascii string).
  * If ep is NULL, assume no truncation check is needed.
  * Return true if truncated.
+ * Stop at ep (if given) or before the null char, whichever is first.
  */
 int
 fn_print(netdissect_options *ndo,
@@ -101,6 +102,7 @@ fn_print(netdissect_options *ndo,
  * Print out a counted filename (or other ascii string).
  * If ep is NULL, assume no truncation check is needed.
  * Return true if truncated.
+ * Stop at ep (if given) or after n bytes, whichever is first.
  */
 int
 fn_printn(netdissect_options *ndo,
@@ -128,6 +130,8 @@ fn_printn(netdissect_options *ndo,
  * Print out a null-padded filename (or other ascii string).
  * If ep is NULL, assume no truncation check is needed.
  * Return true if truncated.
+ * Stop at ep (if given) or after n bytes or before the null char,
+ * whichever is first.
  */
 int
 fn_printzp(netdissect_options *ndo,