Use consistent language for string termination (#806)

Avoid hyphen, prefer space: "null terminated"
This commit is contained in:
ronaldomercado authored and GitHub committed 2026-03-18 10:45:25 -05:00
1 parent f4ccf7bc8c
commit 2d8a6f91a9
16 files changed
+45 -45

No files matched your search

+1 -1
View File
@@ -2751,7 +2751,7 @@ time.</p>
<h4>Arguments</h4>
<dl>
<dt><code>PVNAME</code></dt>
<dd>A nil terminated process variable name string. EPICS process control
<dd>A null terminated process variable name string. EPICS process control
function block database variable names are of the form "&lt;record
name&gt;.&lt;field name&gt;". If the field name and the period separator
are omitted then the "VAL" field is implicit. For example "RFHV01" and
+1 -1
View File
@@ -465,7 +465,7 @@ typedef unsigned capri;
*
* See `caExample.c` in the example application created by `makeBaseApp.pl`.
*
* \param[in] pChanName A nil terminated process variable name string.
* \param[in] pChanName A null terminated process variable name string.
* \parblock
* EPICS process control * function block database variable names are of the
* form `<record name>.<field name>`. If the field name and the period
+1 -1
View File
@@ -128,7 +128,7 @@ LIBCA_API extern const int epicsTypeToDBR_XXXX [lastEpicsType+1];
LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1];
/* values returned for each field type
* DBR_STRING returns a NULL terminated string
* DBR_STRING returns a null terminated string
* DBR_SHORT returns an unsigned short
* DBR_INT returns an unsigned short
* DBR_FLOAT returns an IEEE floating point value
+2 -2
View File
@@ -206,7 +206,7 @@ typedef struct chFilterIf {
*
* Optional.
* \param filter Pointer to instance data.
* \param stringVal Value, not zero-terminated.
* \param stringVal Value, not null terminated.
* \param stringLen Number of chars in \p stringVal.
* \returns \p parse_stop on error, or \p parse_continue
*/
@@ -226,7 +226,7 @@ typedef struct chFilterIf {
*
* Optional.
* \param filter Pointer to instance data.
* \param key Value not zero-terminated.
* \param key Value not null terminated.
* \param stringLen Number of chars in \p key
* \returns \p parse_stop on error, or \p parse_continue
*/
+2 -2
View File
@@ -444,7 +444,7 @@ static long getCharChar(const dbAddr *paddr,
if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) {
/* This is a DBF_STRING field being read as a long string.
* The buffer we return must be zero-terminated.
* The buffer we return must be null terminated.
*/
pdst[--nRequest] = 0;
if (nRequest == 0)
@@ -466,7 +466,7 @@ static long getCharUchar(const dbAddr *paddr,
if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) {
/* This is a DBF_STRING field being read as a long string.
* The buffer we return must be zero-terminated.
* The buffer we return must be null terminated.
*/
pdst[--nRequest] = 0;
if (nRequest == 0)
+1 -1
View File
@@ -111,7 +111,7 @@ typedef struct lset {
/** @brief load constant long string from link type
*
* Usually called during IOC initialization, constant link types must copy a
* nil-terminated string up to size characters long to the buffer provided,
* null terminated string up to size characters long to the buffer provided,
* and write the length of that string to the plen location. A non-constant
* link type can use this as an early hint that subsequent calls to
* dbGetLink() will request long string data, although this might change.
+3 -3
View File
@@ -64,7 +64,7 @@ LIBCOM_API void * dbmfMalloc(size_t bytes);
* \brief Duplicate a string.
*
* Create a copy of the input string.
* \param str Pointer to the null-terminated string to be copied.
* \param str Pointer to the null terminated string to be copied.
* \return A pointer to the new copy, or NULL on failure.
*/
LIBCOM_API char * dbmfStrdup(const char *str);
@@ -73,7 +73,7 @@ LIBCOM_API char * dbmfStrdup(const char *str);
*
* Copy at most len bytes of the input string into a new buffer. If no nil
* terminator is seen in the first \c len bytes a nil terminator is added.
* \param str Pointer to the null-terminated string to be copied.
* \param str Pointer to the null terminated string to be copied.
* \param len Max number of bytes to copy.
* \return A pointer to the new string, or NULL on failure.
*/
@@ -81,7 +81,7 @@ LIBCOM_API char * dbmfStrndup(const char *str, size_t len);
/**
* \brief Concatenate three strings.
* Returns a pointer to a null-terminated string made by concatenating the
* Returns a pointer to a null terminated string made by concatenating the
* three input strings.
* \param lhs Start string to which the others get concatenated to (left part).
* \param mid Next string to be concatenated to the lhs (mid part).
+1 -1
View File
@@ -104,7 +104,7 @@ struct in_addr;
* \return Pointer to the environment variable value string, or
* NULL if no parameter value and default value was empty.
*
* \post A terminating nil will be written to pBuf.
* \post A terminating '\0' will be written to pBuf to ensure it is null terminated.
*/
LIBCOM_API char * epicsStdCall
envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf);
+1 -1
View File
@@ -794,7 +794,7 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level,
r++;
/* translate name (may contain macro references); truncated
quietly if too long but always guaranteed zero-terminated */
quietly if too long but always guaranteed to be null terminated */
trans( handle, entry, level + 1, macEnd, &r, &rn, rn + MAC_SIZE );
refname[MAC_SIZE] = '\0';
+2 -2
View File
@@ -126,7 +126,7 @@ epicsStdCall macPutValue(
* \brief Returns the value of a macro
* \return Returns the length of the value string, <0 if undefined
*
* \c value will be zero-terminated if the length of the value is less than
* \c value will be null terminated if the length of the value is less than
* \c capacity. The return value is the number of characters copied to
* \c value (see below for behavior if the macro is undefined). If \c capacity
* is zero, no characters will be copied to \c value (which may be NULL)
@@ -277,7 +277,7 @@ epicsStdCall macInstallMacros(
* environment variables. It parses the string looking for such
* references and passes them to macGetValue() for translation. It uses
* malloc() to allocate space for the expanded string and returns a
* pointer to this null-terminated string. It returns NULL if the source
* pointer to this null terminated string. It returns NULL if the source
* string contains any undefined references.
*/
LIBCOM_API char *
+2 -2
View File
@@ -36,7 +36,7 @@ c) long macGetValue ( MAC_HANDLE *handle, char *name,
char *value, long maxlen );
Returns up to maxlen characters of the value of macro "name". "value"
will be zero-terminated if the length of the value is less than
will be null terminated if the length of the value is less than
maxlen. The function value will be the number of characters copied to
"value" (see below for behavior if the macro is undefined). If maxlen
is zero, no characters will be copied to "value" (which can be NULL)
@@ -161,7 +161,7 @@ d) char *macEnvExpand( char *src );
environment variables. It parses the string looking for such
references and passes them to macGetValue() for translation. It uses
malloc() to allocate space for the expanded string and returns a
pointer to this null-terminated string. It returns NULL if the source
pointer to this null terminated string. It returns NULL if the source
string contains any undefined references.
e) char *macDefExpand( char *src, MAC_HANDLE *macros );
+5 -5
View File
@@ -37,7 +37,7 @@ extern "C" {
* \p inbuf and \p outbuf to point to the same buffer and \p outsize and \p inlen
* be equal, thus performing the character translation in-place.
*
* \param outbuf buffer to copy string to. The resulting string will be zero-terminated as long as
* \param outbuf buffer to copy string to. The resulting string will be null terminated as long as
* \p outsize is non-zero.
* \param outsize length of output buffer not including the null-terminator.
* \param inbuf buffer to copy from. Null byte terminates the string.
@@ -59,7 +59,7 @@ LIBCOM_API int epicsStrnRawFromEscaped(char *outbuf, size_t outsize,
* All other non-printable characters appear in form `\xHH` where HH are two hex digits.
* Non-printable characters are determined by the C runtime library’s isprint() function.
*
* \param outbuf buffer to copy string to. The resulting string will be zero-terminated as long as
* \param outbuf buffer to copy string to. The resulting string will be null terminated as long as
* @p outsize is non-zero.
* \param outsize length of output buffer not including the null-terminator.
* \param inbuf buffer to copy from. Null byte will not terminates the string.
@@ -159,12 +159,12 @@ LIBCOM_API int epicsStrnGlobMatch(const char *str, size_t len, const char *patte
*/
LIBCOM_API char * epicsStrtok_r(char *s, const char *delim, char **lasts);
/** \brief Calculates a hash of a null-terminated string
/** \brief Calculates a hash of a null terminated string
*
* Calculates a hash of a null-terminated string. Initial seed may be provided which
* Calculates a hash of a null terminated string. Initial seed may be provided which
* permits multiple strings to be combined into a single hash result.
*
*\param str null-terminated string
*\param str null terminated string
*\param seed Optionally provide seed to combine multiple strings in a single hash. Otherwise
* set to 0.
*
+1 -1
View File
@@ -125,7 +125,7 @@ extern "C" {
* correctly return the number of characters that would have been written when
* the output gets truncated, it is not worth trying to fix this as long as
* they return `size-1` instead; the resulting string must always be correctly
* terminated with a zero byte.
* null terminated.
*
* In some scenarios the epicsSnprintf() implementation may not provide the
* correct C99 semantics for the return value when `size` is given as zero.
+1 -1
View File
@@ -196,7 +196,7 @@ extern "C" {
/** Finish generating a JSON array. */
YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand);
/** Access the zero-terminated generator buffer. If incrementally
/** Access the null terminated generator buffer. If incrementally
* outputting JSON, one should call yajl_gen_clear() to clear the
* buffer. This allows stream generation. */
YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand,
+1 -1
View File
@@ -79,7 +79,7 @@ extern "C" {
size_t numberLen);
/** Strings are returned as pointers into the JSON text when
* possible. As a result they are _not_ zero-terminated. */
* possible. As a result they are _not_ null terminated. */
int (* yajl_string)(void * ctx, const unsigned char * stringVal,
size_t stringLen);
+20 -20
View File
@@ -313,13 +313,13 @@ MAIN(epicsStringTest)
memset(result, 'x', sizeof(result));
status = epicsStrnEscapedFromRaw(result, 1, ABCD, 4);
testOk(status == 4, "epicsStrnEscapedFromRaw(out, 1) -> %d (exp. 4)", status);
testOk(result[0] == 0, " 0-terminated");
testOk(result[0] == 0, " null terminated");
testOk(result[1] == 'x', " No overrun");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 1, ABCD, 4);
testOk(status == 0, "epicsStrnRawFromEscaped(out, 1) -> %d (exp. 0)", status);
testOk(result[0] == 0, " 0-terminated");
testOk(result[0] == 0, " null terminated");
testOk(result[1] == 'x', " No overrun");
testDiag("Testing size = epicsStrnEscapedFromRawSize");
@@ -336,19 +336,19 @@ MAIN(epicsStringTest)
memset(result, 'x', sizeof(result));
status = epicsStrnEscapedFromRaw(result, 4, ABCD, 3);
testOk(status == 3, "esc(\"ABCD\", 3) -> %d (exp. 3)", status);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No overrun");
memset(result, 'x', sizeof(result));
status = epicsStrnEscapedFromRaw(result, 4, ABCD, 4);
testOk(status == 4, "esc(\"ABCD\", 4) -> %d (exp. 4)", status);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No overrun");
memset(result, 'x', sizeof(result));
status = epicsStrnEscapedFromRaw(result, 4, ABCD, 5);
testOk(status == 6, "esc(\"ABCD\", 5) -> %d (exp. 8)", status);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No overrun");
testDiag("Testing raw = epicsStrnRawFromEscaped(out, 4, ...)");
@@ -356,20 +356,20 @@ MAIN(epicsStringTest)
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, ABCD, 0);
testOk(status == 0, "raw(\"ABCD\", 0) -> %d (exp. 0)", status);
testOk(result[0] == 0, " 0-terminated");
testOk(result[0] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, ABCD, 1);
testOk(status == 1, "raw(\"ABCD\", 1) -> %d (exp. 1)", status);
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[1] == 0, " 0-terminated");
testOk(result[1] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, ABCD, 2);
testOk(status == 2, "raw(\"ABCD\", 2) -> %d (exp. 2)", status);
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]);
testOk(result[2] == 0, " 0-terminated");
testOk(result[2] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, ABCD, 3);
@@ -377,7 +377,7 @@ MAIN(epicsStringTest)
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]);
testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No write outside buffer");
memset(result, 'x', sizeof(result));
@@ -386,7 +386,7 @@ MAIN(epicsStringTest)
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]);
testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No write outside buffer");
memset(result, 'x', sizeof(result));
@@ -395,49 +395,49 @@ MAIN(epicsStringTest)
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]);
testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]);
testOk(result[3] == 0, " 0-terminated");
testOk(result[3] == 0, " null terminated");
testOk(result[4] == 'x', " No write outside buffer");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "A", 2);
testOk(status == 1, "raw(\"A\", 2) -> %d (exp. 1)", status);
testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x12", 1);
testOk(status == 0, "raw(\"\\x12\", 1) -> %d (exp. 0)", status);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x12", 2);
testOk(status == 0, "raw(\"\\x12\", 2) -> %d (exp. 0)", status);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x12", 3);
testOk(status == 1, "raw(\"\\x12\", 3) -> %d (exp. 1)", status);
testOk(result[0] == 1, " Hex escape (got \\x%x)", result[0]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x12", 4);
testOk(status == 1, "raw(\"\\x12\", 4) -> %d (exp. 1)", status);
testOk(result[0] == 0x12," Hex escape (got \\x%x)", result[0]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\xaF", 4);
testOk(status == 1, "raw(\"\\xaF\", 4) -> %d (exp. 1)", status);
testOk(result[0] == '\xaF'," Hex escape (got \\x%x)", result[0] & 0xFF);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x012", 5);
testOk(status == 2, "raw(\"\\x012\", 5) -> %d (exp. 2)", status);
testOk(result[0] == 0x1," Hex escape (got \\x%x)", result[0]);
testOk(result[1] == '2', " Terminator char got '%c'", result[1]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x0012", 6);
@@ -445,14 +445,14 @@ MAIN(epicsStringTest)
testOk(result[0] == 0," Hex escape (got \\x%x)", result[0]);
testOk(result[1] == '1', " Terminator char got '%c'", result[1]);
testOk(result[2] == '2', " Following char got '%c'", result[2]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
memset(result, 'x', sizeof(result));
status = epicsStrnRawFromEscaped(result, 4, "\\x1g", 4);
testOk(status == 2, "raw(\"\\x1g\", 4) -> %d (exp. 2)", status);
testOk(result[0] == 1, " Hex escape (got \\x%x)", result[0]);
testOk(result[1] == 'g', " Terminator char got '%c'", result[1]);
testOk(result[status] == 0, " 0-terminated");
testOk(result[status] == 0, " null terminated");
testDistance();
testStrTok();