From: Adam Dickmeiss Date: Wed, 10 Jan 2007 10:04:23 +0000 (+0000) Subject: Use memset rather than bzero (obsolete, and sometimes unavailable). X-Git-Tag: rather.stable.2007.01.11~20 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=bdf63c9b34f8a40edec11d50dc71454c0b8daf32;p=pazpar2-moved-to-github.git Use memset rather than bzero (obsolete, and sometimes unavailable). --- diff --git a/src/config.c b/src/config.c index db50400..e99991e 100644 --- a/src/config.c +++ b/src/config.c @@ -1,4 +1,4 @@ -/* $Id: config.c,v 1.7 2007-01-09 18:06:28 quinn Exp $ */ +/* $Id: config.c,v 1.8 2007-01-10 10:04:23 adam Exp $ */ #include @@ -328,7 +328,7 @@ static struct conf_retrievalprofile *parse_retrievalprofile(xmlNode *node) xmlChar *charset = xmlGetProp(n, "charset"); xmlChar *format = xmlGetProp(n, "format"); xmlChar *stylesheet = xmlGetProp(n, "stylesheet"); - bzero(m, sizeof(*m)); + memset(m, 0, sizeof(*m)); if (type) { if (!strcmp(type, "xslt")) diff --git a/src/http.c b/src/http.c index e125b44..cbba2a8 100644 --- a/src/http.c +++ b/src/http.c @@ -1,5 +1,5 @@ /* - * $Id: http.c,v 1.7 2007-01-10 09:35:57 adam Exp $ + * $Id: http.c,v 1.8 2007-01-10 10:04:23 adam Exp $ */ #include @@ -787,7 +787,7 @@ void http_init(const char *addr) yaz_log(YLOG_LOG, "HTTP listener is %s", addr); - bzero(&myaddr, sizeof myaddr); + memset(&myaddr, 0, sizeof myaddr); myaddr.sin_family = AF_INET; pp = strchr(addr, ':'); if (pp) diff --git a/src/pazpar2.c b/src/pazpar2.c index b5a0ee7..e3c3649 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -1,4 +1,4 @@ -/* $Id: pazpar2.c,v 1.22 2007-01-09 22:06:49 quinn Exp $ */; +/* $Id: pazpar2.c,v 1.23 2007-01-10 10:04:23 adam Exp $ */; #include #include @@ -480,7 +480,7 @@ static struct record *ingest_record(struct client *cl, Z_External *rec) res->next = 0; res->metadata = nmem_malloc(se->nmem, sizeof(struct record_metadata*) * service->num_metadata); - bzero(res->metadata, sizeof(struct record_metadata*) * service->num_metadata); + memset(res->metadata, 0, sizeof(struct record_metadata*) * service->num_metadata); mergekey_norm = nmem_strdup(se->nmem, (char*) mergekey); xmlFree(mergekey); @@ -1359,7 +1359,7 @@ void statistics(struct session *se, struct statistics *stat) struct client *cl; int count = 0; - bzero(stat, sizeof(*stat)); + memset(stat, 0, sizeof(*stat)); for (cl = se->clients; cl; cl = cl->next) { if (!cl->connection) diff --git a/src/reclists.c b/src/reclists.c index 27a48f4..732892d 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -1,5 +1,5 @@ /* - * $Id: reclists.c,v 1.5 2007-01-09 22:06:49 quinn Exp $ + * $Id: reclists.c,v 1.6 2007-01-10 10:04:23 adam Exp $ */ #include @@ -61,7 +61,7 @@ struct reclist *reclist_create(NMEM nmem, int numrecs) hashsize <<= 1; res = nmem_malloc(nmem, sizeof(struct reclist)); res->hashtable = nmem_malloc(nmem, hashsize * sizeof(struct reclist_bucket*)); - bzero(res->hashtable, hashsize * sizeof(struct reclist_bucket*)); + memset(res->hashtable, 0, hashsize * sizeof(struct reclist_bucket*)); res->hashtable_size = hashsize; res->nmem = nmem; res->hashmask = hashsize - 1; // Creates a bitmask @@ -113,7 +113,7 @@ struct record_cluster *reclist_insert(struct reclist *l, struct record *record, newc->metadata = 0; newc->metadata = nmem_malloc(l->nmem, sizeof(struct record_metadata*) * service->num_metadata); - bzero(newc->metadata, sizeof(struct record_metadata*) * service->num_metadata); + memset(newc->metadata, 0, sizeof(struct record_metadata*) * service->num_metadata); *p = new; l->flatlist[l->num_records++] = newc; diff --git a/src/relevance.c b/src/relevance.c index b1713e0..a11c053 100644 --- a/src/relevance.c +++ b/src/relevance.c @@ -1,5 +1,5 @@ /* - * $Id: relevance.c,v 1.6 2007-01-08 19:39:12 quinn Exp $ + * $Id: relevance.c,v 1.7 2007-01-10 10:04:23 adam Exp $ */ #include @@ -121,7 +121,7 @@ struct relevance *relevance_create(NMEM nmem, const char **terms, int numrecs) ; res->vec_len = ++i; res->doc_frequency_vec = nmem_malloc(nmem, res->vec_len * sizeof(int)); - bzero(res->doc_frequency_vec, res->vec_len * sizeof(int)); + memset(res->doc_frequency_vec, 0, res->vec_len * sizeof(int)); res->nmem = nmem; res->wt = build_word_trie(nmem, terms); return res; @@ -132,7 +132,7 @@ void relevance_newrec(struct relevance *r, struct record_cluster *rec) if (!rec->term_frequency_vec) { rec->term_frequency_vec = nmem_malloc(r->nmem, r->vec_len * sizeof(int)); - bzero(rec->term_frequency_vec, r->vec_len * sizeof(int)); + memset(rec->term_frequency_vec, 0, r->vec_len * sizeof(int)); } } diff --git a/src/termlists.c b/src/termlists.c index 6c85495..027d057 100644 --- a/src/termlists.c +++ b/src/termlists.c @@ -1,5 +1,5 @@ /* - * $Id: termlists.c,v 1.3 2007-01-08 18:32:35 quinn Exp $ + * $Id: termlists.c,v 1.4 2007-01-10 10:04:23 adam Exp $ */ #include @@ -69,7 +69,7 @@ struct termlist *termlist_create(NMEM nmem, int numterms, int highscore_size) hashsize <<= 1; res = nmem_malloc(nmem, sizeof(struct termlist)); res->hashtable = nmem_malloc(nmem, hashsize * sizeof(struct termlist_bucket*)); - bzero(res->hashtable, hashsize * sizeof(struct termlist_bucket*)); + memset(res->hashtable, 0, hashsize * sizeof(struct termlist_bucket*)); res->hashtable_size = hashsize; res->nmem = nmem; res->hashmask = hashsize - 1; // Creates a bitmask