diff --git a/lib/communication.c b/lib/communication.c index 0faf567..d2c3db0 100644 --- a/lib/communication.c +++ b/lib/communication.c @@ -6,7 +6,7 @@ int file_open (FILE **f, const char *path, const char *mode) { printf ("opening %s\n", path); if (*f != NULL) { - printf ("f != NULL : %p\n", *f); + printf ("f != NULL : %p\n", (void*) *f); fclose (*f); } *f = fopen (path, mode); @@ -35,7 +35,7 @@ void srv_init (struct service *srv, const char *sname) return; // gets the service path, such as /tmp/ - bzero (srv->spath, PATH_MAX); + memset (srv->spath, 0, PATH_MAX); strncat (srv->spath, TMPDIR, PATH_MAX); strncat (srv->spath, sname, PATH_MAX); @@ -93,7 +93,7 @@ int srv_close (struct service *srv) int srv_get_listen_raw (const struct service *srv, char **buf, size_t *msize) { *buf = malloc(BUFSIZ); - bzero (*buf, BUFSIZ); + memset (*buf, 0, BUFSIZ); FILE * f = fopen (srv->spath, "r"); fgets (*buf, BUFSIZ, f); @@ -111,7 +111,7 @@ int srv_get_new_process (const struct service *srv, struct process *p) } char buf[BUFSIZ]; - bzero (buf, BUFSIZ); + memset (buf, 0, BUFSIZ); // read the pipe, get a process to work on struct timespec ts = { 0 }; diff --git a/lib/process.c b/lib/process.c index 0548fa3..be4086b 100644 --- a/lib/process.c +++ b/lib/process.c @@ -24,8 +24,8 @@ void srv_process_gen (struct process *p p->version = version; p->index = index; - bzero (p->path_in, PATH_MAX); - bzero (p->path_out, PATH_MAX); + memset (p->path_in, 0, PATH_MAX); + memset (p->path_out, 0, PATH_MAX); snprintf(p->path_in , PATH_MAX, "%s/%d-%d-in" , TMPDIR, pid, index); snprintf(p->path_out, PATH_MAX, "%s/%d-%d-out", TMPDIR, pid, index); p->in = NULL; diff --git a/lib/pubsubd.c b/lib/pubsubd.c index 7c7815f..184fa43 100644 --- a/lib/pubsubd.c +++ b/lib/pubsubd.c @@ -52,7 +52,7 @@ struct channel * pubsubd_channel_copy (struct channel *c) struct channel *copy = NULL; copy = malloc (sizeof(struct channel)); - bzero (copy, sizeof (struct channel)); + memset (copy, 0, sizeof (struct channel)); memcpy (copy, c, sizeof(struct channel)); @@ -334,7 +334,7 @@ int pubsubd_get_new_process (struct service *srv, struct app_list_elm *ale int version = 0; char chan[BUFSIZ]; - bzero (chan, BUFSIZ); + memset (chan, 0, BUFSIZ); for (str = buf, i = 1; ; str = NULL, i++) { token = strtok_r(str, " ", &saveptr); @@ -542,7 +542,7 @@ void pubsub_connection (struct service *srv, struct process *p, enum app_list_el straction = pubsub_action_to_str (action); char line[BUFSIZ]; - bzero (line, BUFSIZ); + memset (line, 0, BUFSIZ); // line fmt : pid index version action chan // "quit" action is also possible (see pubsub_disconnect) diff --git a/pubsub/pubsub-test-send.c b/pubsub/pubsub-test-send.c index b5a6ea5..5e2c6a8 100644 --- a/pubsub/pubsub-test-send.c +++ b/pubsub/pubsub-test-send.c @@ -15,12 +15,12 @@ ohshit(int rvalue, const char* str) { main(int argc, char* argv[]) { struct service srv; - bzero (&srv, sizeof (struct service)); + memset (&srv, 0, sizeof (struct service)); srv_init (&srv, PUBSUB_SERVICE_NAME); printf ("Writing on %s.\n", srv.spath); struct process p; - bzero (&p, sizeof (struct process)); + memset (&p, 0, sizeof (struct process)); int index = 1; if (app_create (&p, index)) // called by the application @@ -31,7 +31,7 @@ main(int argc, char* argv[]) pubsub_connection (&srv, &p, PUBSUB_PUB, MYCHAN); struct pubsub_msg m; - bzero (&m, sizeof (struct pubsub_msg)); + memset (&m, 0, sizeof (struct pubsub_msg)); // first message, "coucou" m.type = PUBSUB_TYPE_INFO; diff --git a/pubsub/pubsubd.c b/pubsub/pubsubd.c index f982f5e..7c6fc37 100644 --- a/pubsub/pubsubd.c +++ b/pubsub/pubsubd.c @@ -27,7 +27,7 @@ void * pubsubd_worker_thread (void *params) printf ("publish or publish and subscribe to something\n"); struct pubsub_msg m; - bzero (&m, sizeof (struct pubsub_msg)); + memset (&m, 0, sizeof (struct pubsub_msg)); pubsubd_msg_recv (wp->ale->p, &m); pubsubd_msg_print (&m); @@ -46,7 +46,7 @@ void * pubsubd_worker_thread (void *params) } else { printf ("\033[31mdo not know what you want to do\033[00m\n"); - printf ("\tale->p : %p\n", wp->ale->p); + printf ("\tale->p : %p\n", (void*) wp->ale->p); } pubsubd_app_list_elm_free (wp->ale); @@ -58,7 +58,7 @@ void * pubsubd_worker_thread (void *params) main(int argc, char* argv[]) { struct service srv; - bzero (&srv, sizeof (struct service)); + memset (&srv, 0, sizeof (struct service)); srv_init (&srv, PUBSUB_SERVICE_NAME); printf ("Listening on %s.\n", srv.spath); @@ -68,13 +68,13 @@ main(int argc, char* argv[]) // init chans list struct channels chans; - bzero (&chans, sizeof (struct channels)); + memset (&chans, 0, sizeof (struct channels)); pubsubd_channels_init (&chans); for (;;) { // for each new process struct app_list_elm ale; - bzero (&ale, sizeof (struct app_list_elm)); + memset (&ale, 0, sizeof (struct app_list_elm)); struct channel *chan = NULL; pubsubd_get_new_process (&srv, &ale, &chans, &chan); pubsubd_channels_print (&chans);