Comments (3)
@tuchun, yes that is a bug. Thanks for reporting it.
Do you want to send a pull request for this change? Since you found and fixed it, you might as well commit it :)
from c-utils.
@tuchun, yes that is a bug. Thanks for reporting it.
Do you want to send a pull request for this change? Since you found and fixed it, you might as well commit it :)
No ^_^, just fix it, there is also a problem with the test , free is called after delete, so cannot be tested correctly.
TEST_DEF(hashmap)
{
char *buf;
const char * const *words;
size_t size, count;
hash_map_t map;
TEST_MOD_INIT();
TEST_MOD_READ_FILE("words_alpha.txt", &buf, &size);
count = test_build_word_list(buf, &words);
hash_map_init(&map);
TEST_MOD_EXEC( test_dict_insert(&map, words, count) );
TEST_MOD_EXEC( test_dict_iterator(&map, words, count) );
//test_dict_delete has freed the map
TEST_MOD_EXEC( test_dict_delete(&map, words, count) );
TEST_MOD_EXEC( map.count );
//so hash_map_free not covered by tests
hash_map_free(&map, free_test_hashmap_value);
safe_free(buf);
safe_free((void *)words);
TEST_MOD_REPORT();
}
from c-utils.
One bug covering for another, very typical. 🤯
Thanks, fixed both.
from c-utils.
Related Issues (15)
- doesn't compile HOT 1
- This is test issue
- utils.c/hexdup() does not print string when length is exactly 16
- The description for CIRC_GBUF_PEEK and CIRC_GBUF_POP is interchanged HOT 1
- inline functions are not inlined HOT 9
- FILO.c how to make it Circular HOT 1
- Using circular buff with a typedef HOT 1
- push_count and pop_count overflow HOT 10
- Are structures properly stored and retrieved? HOT 1
- warning: ISO C forbids nested functions HOT 2
- Purpose of zero_pad(tail, circ_buf->element_size); HOT 2
- circ_gbuf_free_space incorrect HOT 1
- Since `circ_gbuf_free_space` is not thread safe than`circ_gbuf_pop` and `circ_gbuf_pop` are also not thread safe. HOT 4
- Length Bug, or documentation bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-utils.