sv: major refactor
- Internal data pointer is read only by default => any uses that require use of the pointer itself (freeing, mutating) must perform a cast. - refactor tests to use some new sv macros and functions, and clean them up. - slight cleanup of sv.c
This commit is contained in:
@@ -107,7 +107,7 @@ void stream_free(stream_t *stream)
|
||||
switch (stream->type)
|
||||
{
|
||||
case STREAM_TYPE_STRING:
|
||||
free(stream->string.data);
|
||||
free((char *)stream->string.data);
|
||||
break;
|
||||
case STREAM_TYPE_FILE:
|
||||
case STREAM_TYPE_PIPE:
|
||||
|
||||
4
src/sv.c
4
src/sv.c
@@ -58,8 +58,6 @@ sv_t sv_till(sv_t sv, const char *reject)
|
||||
++offset)
|
||||
continue;
|
||||
|
||||
if (offset == sv.size)
|
||||
return sv;
|
||||
return sv_truncate(sv, offset);
|
||||
}
|
||||
|
||||
@@ -73,8 +71,6 @@ sv_t sv_while(sv_t sv, const char *accept)
|
||||
++offset)
|
||||
continue;
|
||||
|
||||
if (offset == sv.size)
|
||||
return sv;
|
||||
return sv_truncate(sv, offset);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user