Date: Fri, 08 Oct 2004 17:21:12 +0200 From: Danny Braniss <danny@cs.huji.ac.il> To: Andreas Klemm <andreas@klemm.apsfilter.org> Cc: "Jonathan A. Zdziarski" <jonathan@nuclearelephant.com> Subject: Re: please help with: warning: initialization makes integer from pointer Message-ID: <20041008152114.8A64C43D39@mx1.FreeBSD.org> In-Reply-To: Message from Andreas Klemm <andreas@klemm.apsfilter.org> <20041007174322.GB3414@titan.klemm.apsfilter.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> Dear FreeBSD hackers, > > could somebody please help Jonathan, the dspam owner, how to code > this best under FreeBSD ? > > Please see his question below: > > On Thu, Oct 07, 2004 at 01:16:17PM -0400, Jonathan A. Zdziarski wrote: > > I'm a little concerned about these warnings: > > > > pgsql_drv.c:873: warning: initialization makes integer from pointer > > without a cast > > pgsql_drv.c:874: warning: initialization makes integer from pointer > > without a cast > > > > This could cause some problems with dspam. Is there a freeBSDish way to > > do this: > > > > s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > > s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > > > > Perhaps memset(s->p_getpwnam, 0, sizeof(struct passwd)) ? > > > > > > >make all-recursive > > >Making all in . > > >[...] > > > gcc -DHAVE_CONFIG_H -DLOGDIR=\"/var/mail/dspam\" > > > -DCONFIG_DEFAULT=\"/etc/dspam.conf\" -D_REENTRANT > > > -D_POSIX_PTHREAD_SEMANTICS -I. -I. -I. -I/usr/local/include -g -O2 -Wall > > > -Wmissing-prototypes -Wmissing-declarations -MT pgsql_drv.lo -MD -MP -MF > > > .deps/pgsql_drv.Tpo -c pgsql_drv.c -fPIC -DPIC -o .libs/pgsql_drv.o > > >pgsql_drv.c: In function `_ds_init_storage': > > >pgsql_drv.c:873: warning: initialization makes integer from pointer > > >without a cast > > >pgsql_drv.c:874: warning: initialization makes integer from pointer > > >without a cast > > >pgsql_drv.c: In function `_ds_create_signature_id': > > >pgsql_drv.c:1028: warning: long unsigned int format, time_t arg (arg 4) > > >pgsql_drv.c:1028: warning: long unsigned int format, time_t arg (arg 4) > > >[...] > > int > _ds_init_storage (DSPAM_CTX * CTX, void *dbh) > { > struct _pgsql_drv_storage *s; > FILE *file; > char filename[MAX_FILENAME_LENGTH]; > char buffer[256]; > char hostname[128] = ""; > char user[64] = ""; > char password[32] = ""; > char db[64] = ""; > int port = 5432, i = 0; > // PGresult *result; > > /* don't init if we're already initted */ > if (CTX->storage != NULL) > { > LOGDEBUG ("_ds_init_storage: storage already initialized"); > return EINVAL; > } > > s = malloc (sizeof (struct _pgsql_drv_storage)); > if (s == NULL) > { > LOG (LOG_CRIT, ERROR_MEM_ALLOC); > return EUNKNOWN; > } > > s->dbh = NULL; > s->control_token = 0; > s->iter_user = NULL; > s->iter_token = NULL; > s->iter_sig = NULL; > s->control_token = 0; > s->control_sh = 0; > s->control_ih = 0; > s->dbh_attached = (dbh) ? 1 : 0; > s->u_getnextuser[0] = 0; > s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > ^^^^^^^^^^^^^^^^^^^^ ! > s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL }; > ^^^^^^^^^^^^^^^^^^^^ ! > > > > > Andreas /// what about: s = calloc (1, sizeof (struct _pgsql_drv_storage)); if (s == NULL) { LOG (LOG_CRIT, ERROR_MEM_ALLOC); return EUNKNOWN; } if(dbh) s->dbh_attached = 1; danny
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041008152114.8A64C43D39>