Closed misdoro closed 7 years ago
Is there any special reason why malloc + memset pair was used?
Not particularly. Habit, probably...
This broke ttwatchd
. The copy_options
function was using malloc
+ memcpy
to make a copy of the existing structure, not malloc
+ memset
. Changing this to calloc
broke it as it no longer made a copy. I have fixed it again.
Some cosmetic changes:
Use calloc(1, sizeof(block)) instead of malloc(sizeof(block)) & memset(ptr, 0, sizeof(block)) They are equivalent and calloc seems to be faster on most systems http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc for example