]> Savannah Git Hosting - gnulib.git/commit
parse-datetime: improve debug implementation
authorAssaf Gordon <assafgordon@gmail.com>
Mon, 15 Aug 2016 01:29:50 +0000 (21:29 -0400)
committerPádraig Brady <P@draigBrady.com>
Fri, 19 Aug 2016 20:43:13 +0000 (21:43 +0100)
commit5d36768ce2b907af7861d9eb87ae0fc89330def1
tree347e490790738218981be695645be50b93aca12b
parent6e2966216e4e0605508c5f5abd27c8dc44ff6b73
parse-datetime: improve debug implementation

Follow-up to commit 12ad79069 ("add optional debug printing").
Improve parse-datetime's debug implementation: remove macros,
replace global debug flag variable with a function parameter,
use nstrftime for formatting.
See: https://lists.gnu.org/archive/html/bug-gnulib/2016-08/msg00021.html

* lib/parse-datetime.h: (parse_datetime_debug): Remove global extern
declaration.
(parse_datetime2): New function, accepts 'flags' parameter, supporting
debug flag. Existing interface 'parse_datetime' left unmodified.
* lib/parse-datetime.c: (parse_datetime_debug): Remove global variable.
(struct parser_control): add 'parse_datetime_debug' member variable.
(parse_datetime): Call new function 'parse_datetime2' without debug.
(parse_datetime2): Adapted from previous 'parse_datetime', initialize
pc.parse_datetime_debug variable as needed.
(to_year): Accept new flags parameter, instead of using global variable.
(debug_print_current_time,debug_print_relative_time,debug_mktime_not_ok):
use struct 'debug' variable instead of global variable.
(DEBUG,DEBUG_PRINT_CURRENT_TIME,DEBUG_PRINT_RELATIVE_TIME,
DEBUG_MKTIME_NOT_OK,PROGRESS,PROGRESS0): Remove macros. Call
correspnding functions directly instead of using macros.
* modules/parse-datetime: Add gnulib's strftime module.
ChangeLog
lib/parse-datetime.h
lib/parse-datetime.y
modules/parse-datetime