Browse code

core: Document that a str can be zero-terminated

But by default it isn't.

The functions shm_str_dup() and pkg_str_dup() will always create a
zero-terminated copy

Alex Hermann authored on 20/10/2020 12:58:28 • Henning Westerholt committed on 21/10/2020 05:40:24
Showing 1 changed files
... ...
@@ -40,13 +40,16 @@
40 40
  * need to make a zero-terminated copy of it.
41 41
  *
42 42
  * @section drawbacks Drawbacks
43
- * Note well that the fact that string stored
44
- * using this data structure are not zero terminated makes them a little
45
- * incovenient to use with many standard libc string functions, because these
46
- * usually expect the input to be zero-terminated. In this case you have to
47
- * either make a zero-terminated copy or inject the terminating zero behind
48
- * the actuall string (if possible). Note that injecting a zero terminating
49
- * characters is considered to be dangerous.
43
+ * Note well that the fact that a string stored
44
+ * using this data structure are not guaranteed to be zero terminated (by
45
+ * default they're not) makes them a little incovenient to use with many
46
+ * standard libc string functions, because these usually expect the input
47
+ * to be zero-terminated.
48
+ * In this case you have to either make a zero-terminated copy or inject the
49
+ * terminating zero behind the actuall string (if possible). Note that
50
+ * injecting a zero terminating characters is considered to be dangerous.
51
+ * The functions shm_str_dup() and pkg_str_dup() will always create a
52
+ * zero-terminated copy.
50 53
  */
51 54
 
52 55
 /** @file