no need for allowed length

This commit is contained in:
Alex Groce
2018-12-31 08:12:03 -07:00
parent 58a1d5120d
commit abba98ad2a
3 changed files with 6 additions and 7 deletions
+1 -2
View File
@@ -165,8 +165,7 @@ extern void *DeepState_ConcretizeData(void *begin, void *end);
/* Assign a symbolic C string of length `len` with only chars in allowed,
* if allowed is non-null */
extern void DeepState_AssignCStr(char* str, size_t len, const char* allowed,
size_t allowed_size);
extern void DeepState_AssignCStr(char* str, size_t len, const char* allowed);
/* Return a symbolic C string of length `len`. */
extern char *DeepState_CStr(size_t len);
+3 -3
View File
@@ -472,10 +472,10 @@ struct Comparer {
};
/* Like DeepState_AssignCStr, but Pumps through possible string sizes. */
inline static void DeepState_AssignCStrMax(char* str, size_t max_len, const char* allowed,
size_t allowed_size) {
inline static void DeepState_AssignCStrMax(char* str, size_t max_len,
const char* allowed) {
uint32_t size = DeepState_UIntInRange(0, max_len);
DeepState_AssignCStr(str, Pump(size, max_len), allowed, allowed_size);
DeepState_AssignCStr(str, Pump(size, max_len), allowed);
}
/* Like DeepState_CStr, but Pumps through possible string sizes. */
+2 -2
View File
@@ -176,14 +176,14 @@ void *DeepState_ConcretizeData(void *begin, void *end) {
}
/* Assign a symbolic C string of length `len`. */
void DeepState_AssignCStr(char* str, size_t len, const char* allowed,
size_t allowed_size) {
void DeepState_AssignCStr(char* str, size_t len, const char* allowed) {
if (SIZE_MAX == len) {
DeepState_Abandon("Can't create an SIZE_MAX-length string.");
}
if (NULL == str) {
DeepState_Abandon("Attempted to populate null pointer.");
}
uint32_t allowed_size = strlen(allowed);
for (int i = 0; i < len; i++) {
str[i] = allowed[DeepState_UIntInRange(0, allowed_size)];
}