Re: [HACKERS] compile warning in CVS HEAD - Mailing list pgsql-patches
From | Andrew Dunstan |
---|---|
Subject | Re: [HACKERS] compile warning in CVS HEAD |
Date | |
Msg-id | 405A2A2A.2090806@dunslane.net Whole thread Raw |
Responses |
Re: [HACKERS] compile warning in CVS HEAD
(Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] compile warning in CVS HEAD (Bruce Momjian <pgman@candle.pha.pa.us>) Re: [HACKERS] compile warning in CVS HEAD (Bruce Momjian <pgman@candle.pha.pa.us>) |
List | pgsql-patches |
Patch attached. Also adds a malloc() check that Neil wanted. cheers andrew Tom Lane wrote: >Andrew Dunstan <andrew@dunslane.net> writes: > > >>*sigh* >> >> > > > >>my local (linux) man for gettimeofday says this: >> >> > > > >> struct timeval { >> time_t tv_sec; /* seconds */ >> suseconds_t tv_usec; /* microseconds */ >> }; >> >> > >Yeah, but mine (HPUX) says that tv_sec is "unsigned long". I suspect >that on Darwin the types disagree as to signedness. > > > >>We could do what you say, or could we just cast it? >> >> > >If they really were different types (as in different widths) then >casting the pointer would be a highly Wrong Thing. I think copying >to a local is safer, even if it does waste a cycle or two. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > > Index: src/backend/utils/error/elog.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/error/elog.c,v retrieving revision 1.128 diff -c -r1.128 elog.c *** src/backend/utils/error/elog.c 15 Mar 2004 15:56:23 -0000 1.128 --- src/backend/utils/error/elog.c 18 Mar 2004 22:55:44 -0000 *************** *** 1035,1041 **** --- 1035,1045 ---- int result_len = 2*NAMEDATALEN + format_len +120 ; if (result == NULL) + { result = malloc(result_len); + if (result == NULL) + return ""; + } result[0] = '\0'; if (format_len > 0) *************** *** 1119,1126 **** localtime(&stamp_time)); break; case 's': j += strftime(result+j, result_len-j, "%Y-%m-%d %H:%M:%S", ! localtime(&(MyProcPort->session_start.tv_sec))); break; case 'i': j += snprintf(result+j,result_len-j,"%s", --- 1123,1131 ---- localtime(&stamp_time)); break; case 's': + stamp_time = (time_t)(MyProcPort->session_start.tv_sec); j += strftime(result+j, result_len-j, "%Y-%m-%d %H:%M:%S", ! localtime(&stamp_time)); break; case 'i': j += snprintf(result+j,result_len-j,"%s",
pgsql-patches by date: