Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/af1cc1c223bdb7f2337e726268031d3151474561
...commit
http://git.netsurf-browser.org/libcss.git/commit/af1cc1c223bdb7f2337e726268031d3151474561
...tree
http://git.netsurf-browser.org/libcss.git/tree/af1cc1c223bdb7f2337e726268031d3151474561
The branch, master has been updated
via af1cc1c223bdb7f2337e726268031d3151474561 (commit)
from 3b4fdeafdbed6b779b3b826eda9c9b703dd8c0a1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=af1cc1c223bdb7f2337e726268031d3151474561
commit af1cc1c223bdb7f2337e726268031d3151474561
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
Selection hash module: calloc instead of malloc, memset.
diff --git a/src/select/hash.c b/src/select/hash.c
index 57ab2e5..4807e0f 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -150,42 +150,38 @@ css_error css__selector_hash_create(css_selector_hash
**hash)
if (hash == NULL)
return CSS_BADPARM;
- h = malloc(sizeof(css_selector_hash));
+ h = calloc(1, sizeof(css_selector_hash));
if (h == NULL)
return CSS_NOMEM;
/* Element hash */
- h->elements.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->elements.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->elements.slots == NULL) {
free(h);
return CSS_NOMEM;
}
- memset(h->elements.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->elements.n_slots = DEFAULT_SLOTS;
/* Class hash */
- h->classes.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->classes.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->classes.slots == NULL) {
free(h->elements.slots);
free(h);
return CSS_NOMEM;
}
- memset(h->classes.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->classes.n_slots = DEFAULT_SLOTS;
/* ID hash */
- h->ids.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->ids.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->ids.slots == NULL) {
free(h->classes.slots);
free(h->elements.slots);
free(h);
return CSS_NOMEM;
}
- memset(h->ids.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->ids.n_slots = DEFAULT_SLOTS;
- /* Universal chain */
- memset(&h->universal, 0, sizeof(hash_entry));
+ /* Universal chain head already initiliased by calloc of `h`. */
h->hash_size = sizeof(css_selector_hash) +
DEFAULT_SLOTS * sizeof(hash_entry) +
-----------------------------------------------------------------------
Summary of changes:
src/select/hash.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/select/hash.c b/src/select/hash.c
index 57ab2e5..4807e0f 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -150,42 +150,38 @@ css_error css__selector_hash_create(css_selector_hash
**hash)
if (hash == NULL)
return CSS_BADPARM;
- h = malloc(sizeof(css_selector_hash));
+ h = calloc(1, sizeof(css_selector_hash));
if (h == NULL)
return CSS_NOMEM;
/* Element hash */
- h->elements.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->elements.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->elements.slots == NULL) {
free(h);
return CSS_NOMEM;
}
- memset(h->elements.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->elements.n_slots = DEFAULT_SLOTS;
/* Class hash */
- h->classes.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->classes.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->classes.slots == NULL) {
free(h->elements.slots);
free(h);
return CSS_NOMEM;
}
- memset(h->classes.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->classes.n_slots = DEFAULT_SLOTS;
/* ID hash */
- h->ids.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry));
+ h->ids.slots = calloc(DEFAULT_SLOTS, sizeof(hash_entry));
if (h->ids.slots == NULL) {
free(h->classes.slots);
free(h->elements.slots);
free(h);
return CSS_NOMEM;
}
- memset(h->ids.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry));
h->ids.n_slots = DEFAULT_SLOTS;
- /* Universal chain */
- memset(&h->universal, 0, sizeof(hash_entry));
+ /* Universal chain head already initiliased by calloc of `h`. */
h->hash_size = sizeof(css_selector_hash) +
DEFAULT_SLOTS * sizeof(hash_entry) +
--
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org