improve comments

This commit is contained in:
Alex Groce
2019-01-02 13:53:15 -07:00
parent 87fcbf3481
commit 240eb9f813
3 changed files with 12 additions and 8 deletions

View File

@@ -167,7 +167,7 @@ extern void DeepState_SymbolizeDataNoNull(void *begin, void *end);
extern void *DeepState_ConcretizeData(void *begin, void *end);
/* Assign a symbolic C string of _strlen_ `len` -- with only chars in allowed,
* if allowed is non-null; needs space for null + len bytes */
* if `allowed` is non-null; needs space for null + len bytes */
extern void DeepState_AssignCStr_C(char* str, size_t len, const char* allowed);
/* Return a symbolic C string of strlen `len`. */

View File

@@ -471,7 +471,7 @@ struct Comparer {
}
};
/* Like DeepState_AssignCStr_C, but fills in a null allowed. */
/* Like DeepState_AssignCStr_C, but fills in a null `allowed` value. */
inline static void DeepState_AssignCStr(char* str, size_t len,
const char* allowed = 0) {
DeepState_AssignCStr_C(str, len, allowed);
@@ -484,7 +484,7 @@ inline static void DeepState_AssignCStrUpToLen(char* str, size_t max_len,
DeepState_AssignCStr_C(str, Pump(len, max_len+1), allowed);
}
/* Like DeepState_CStr_C, but fills in a null allowed. */
/* Like DeepState_CStr_C, but fills in a null `allowed` value. */
inline static char* DeepState_CStr(size_t len, const char* allowed = 0) {
return DeepState_CStr_C(len, allowed);
}
@@ -495,7 +495,8 @@ inline static char* DeepState_CStrUpToLen(size_t max_len, const char* allowed =
return DeepState_CStr_C(Pump(len, max_len+1), allowed);
}
inline static void DeepState_SymbolizeCStr_C(char *begin, const char* allowed = 0) {
/* Like DeepState_Symbolize_CStr, but fills in null `allowed` value. */
inline static void DeepState_SymbolizeCStr(char *begin, const char* allowed = 0) {
DeepState_SymbolizeCStr_C(begin, allowed);
}

View File

@@ -170,7 +170,8 @@ void DeepState_SymbolizeData(void *begin, void *end) {
}
}
/* Symbolize the data in the exclusive range `[begin, end)`. */
/* Symbolize the data in the exclusive range `[begin, end)` without null
* characters included. Primarily useful for C strings. */
void DeepState_SymbolizeDataNoNull(void *begin, void *end) {
uintptr_t begin_addr = (uintptr_t) begin;
uintptr_t end_addr = (uintptr_t) end;
@@ -201,7 +202,9 @@ void *DeepState_ConcretizeData(void *begin, void *end) {
return begin;
}
/* Assign a symbolic C string of length `len`. */
/* Assign a symbolic C string of strlen length `len`. str should include
* storage for both `len` characters AND the null terminator. Allowed
* is a set of chars that are allowed (ignored if null). */
void DeepState_AssignCStr_C(char* str, size_t len, const char* allowed) {
if (SIZE_MAX == len) {
DeepState_Abandon("Can't create an SIZE_MAX-length string.");
@@ -222,7 +225,7 @@ void DeepState_AssignCStr_C(char* str, size_t len, const char* allowed) {
str[len] = '\0';
}
/* Return a symbolic C string of length `len`. */
/* Return a symbolic C string of strlen `len`. */
char *DeepState_CStr_C(size_t len, const char* allowed) {
if (SIZE_MAX == len) {
DeepState_Abandon("Can't create an SIZE_MAX-length string.");
@@ -246,7 +249,7 @@ char *DeepState_CStr_C(size_t len, const char* allowed) {
return str;
}
/* Symbolize a C string */
/* Symbolize a C string; keeps the null terminator where it was. */
void DeepState_SymbolizeCStr_C(char *begin, const char* allowed) {
if (begin && begin[0]) {
if (!allowed) {