From: Ben Pfaff Date: Tue, 19 Jan 2010 00:10:10 +0000 (-0800) Subject: message: Fix corner case in msg_emit(). X-Git-Tag: fc11-i386-build78~3 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=23ebdca02083440bb1abc63fc81e0b5d1cdc9f8a message: Fix corner case in msg_emit(). In most cases, msg_emit() initialized the "where" member of the message passed in. However, if msg_init() had not yet been called, it did not do this. This fixes that corner case. In addition, one caller of msg_emit() did not initialize these members. It is not necessary for both msg_emit() and its callers to do so, but since most callers did so, this commit simply makes the remaining caller do so as well, for consistency. --- diff --git a/src/data/data-in.c b/src/data/data-in.c index 33e369f9..285c777b 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -1202,6 +1202,8 @@ vdata_warning (const struct data_in *i, const char *format, va_list args) m.category = MSG_DATA; m.severity = MSG_WARNING; m.text = ds_cstr (&text); + m.where.file_name = NULL; + m.where.line_number = -1; msg_emit (&m); } diff --git a/src/libpspp/message.c b/src/libpspp/message.c index 2cd0bff5..6b4848a3 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -109,6 +109,11 @@ msg_emit (struct msg *m) { if ( s_stream ) get_msg_location (s_stream, &m->where); + else + { + m->where.file_name = NULL; + m->where.line_number = -1; + } if (!messages_disabled) msg_handler (m);