Skip to content

Commit

Permalink
vstring: verify the result of cast with Assert
Browse files Browse the repository at this point in the history
Suggested by @b4n in
#3690 (comment).
  • Loading branch information
masatake committed May 13, 2023
1 parent 8c5158c commit a6d74d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main/vstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <stdio.h>

#include "debug.h"
#include "inline.h"

/*
Expand Down Expand Up @@ -107,6 +108,7 @@ CTAGS_INLINE void vStringPut (vString *const string, const int c)
vStringResize (string, string->size * 2);

string->buffer [string->length] = (char) c;
Assert (string->buffer [string->length] == c);
if (c != '\0')
string->buffer [++string->length] = '\0';
}
Expand Down

0 comments on commit a6d74d9

Please sign in to comment.