Mercurial > hg > sidinfo
changeset 100:be62e4abe3a9
Rename a structure member.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 15 Feb 2016 00:28:50 +0200 |
parents | 29a080678091 |
children | 9d4d1783800b |
files | sidlib.c sidlib.h |
diffstat | 2 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/sidlib.c Sun Feb 14 20:38:09 2016 +0200 +++ b/sidlib.c Mon Feb 15 00:28:50 2016 +0200 @@ -455,25 +455,25 @@ th_free_r(&dbh->pindex); // Get size of db - for (node = dbh->nodes, dbh->n = 0; node != NULL; node = node->next) - dbh->n++; + for (node = dbh->nodes, dbh->nnodes = 0; node != NULL; node = node->next) + dbh->nnodes++; // Check number of nodes - if (dbh->n > 0) + if (dbh->nnodes > 0) { size_t i; // Allocate memory for index-table - dbh->pindex = (SIDLibSLDBNode **) th_malloc(sizeof(SIDLibSLDBNode *) * dbh->n); + dbh->pindex = (SIDLibSLDBNode **) th_malloc(sizeof(SIDLibSLDBNode *) * dbh->nnodes); if (dbh->pindex == NULL) return THERR_MALLOC; // Get node-pointers to table - for (i = 0, node = dbh->nodes; node && i < dbh->n; node = node->next) + for (i = 0, node = dbh->nodes; node && i < dbh->nnodes; node = node->next) dbh->pindex[i++] = node; // Sort the indexes - qsort(dbh->pindex, dbh->n, sizeof(SIDLibSLDBNode *), si_sldb_compare_nodes); + qsort(dbh->pindex, dbh->nnodes, sizeof(SIDLibSLDBNode *), si_sldb_compare_nodes); } return THERR_OK; @@ -495,7 +495,7 @@ } dbh->nodes = NULL; - dbh->n = 0; + dbh->nnodes = 0; th_free_r(&dbh->pindex); th_free(dbh); @@ -509,7 +509,7 @@ memcpy(&keyItem.hash, hash, sizeof(th_md5hash_t)); key = &keyItem; - item = bsearch(&key, dbh->pindex, dbh->n, sizeof(dbh->pindex[0]), si_sldb_compare_nodes); + item = bsearch(&key, dbh->pindex, dbh->nnodes, sizeof(dbh->pindex[0]), si_sldb_compare_nodes); return (item != NULL) ? *item : NULL; }