mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-13 08:02:56 +00:00
Fixed cppcheck 2.9 warnings
The warnings were: variableScope,expat/tests/chardata.c:83,style,The scope of the variable 'buffer' can be reduced. constParameter,expat/tests/memcheck.c:85,style,Parameter 'ptr' can be declared as pointer to const variableScope,expat/tests/structdata.c:106,style,The scope of the variable 'i' can be reduced.
This commit is contained in:
parent
e3c91d0770
commit
ce15e2c219
3 changed files with 4 additions and 5 deletions
|
@ -80,13 +80,13 @@ CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) {
|
|||
|
||||
int
|
||||
CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) {
|
||||
char buffer[1024];
|
||||
int len = xmlstrlen(expected);
|
||||
int count;
|
||||
|
||||
assert(storage != NULL);
|
||||
count = (storage->count < 0) ? 0 : storage->count;
|
||||
if (len != count) {
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "wrong number of data characters: got %d, expected %d",
|
||||
count, len);
|
||||
fail(buffer);
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct allocation_entry {
|
|||
static AllocationEntry *alloc_head = NULL;
|
||||
static AllocationEntry *alloc_tail = NULL;
|
||||
|
||||
static AllocationEntry *find_allocation(void *ptr);
|
||||
static AllocationEntry *find_allocation(const void *ptr);
|
||||
|
||||
/* Allocate some memory and keep track of it. */
|
||||
void *
|
||||
|
@ -82,7 +82,7 @@ tracking_malloc(size_t size) {
|
|||
}
|
||||
|
||||
static AllocationEntry *
|
||||
find_allocation(void *ptr) {
|
||||
find_allocation(const void *ptr) {
|
||||
AllocationEntry *entry;
|
||||
|
||||
for (entry = alloc_head; entry != NULL; entry = entry->next) {
|
||||
|
|
|
@ -103,7 +103,6 @@ void
|
|||
StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
|
||||
int count) {
|
||||
char buffer[1024];
|
||||
int i;
|
||||
|
||||
assert(storage != NULL);
|
||||
assert(expected != NULL);
|
||||
|
@ -113,7 +112,7 @@ StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
|
|||
StructData_Dispose(storage);
|
||||
fail(buffer);
|
||||
} else {
|
||||
for (i = 0; i < count; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
const StructDataEntry *got = &storage->entries[i];
|
||||
const StructDataEntry *want = &expected[i];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue