r82152 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82151‎ | r82152 | r82153 >
Date:22:55, 14 February 2011
Author:platonides
Status:ok
Tags:
Comment:
Made wmerrors_cb() static.
Provide a full hostname for README added in r82112.
r82046 follow up. Add header for php_basename().
Use NULL instead of 0 in smart_str initializations.
Repeat the staticness of write_full_backtrace() in the declaration for clarity (it's not required).
Modified paths:
  • /trunk/php/wmerrors/README (modified) (history)
  • /trunk/php/wmerrors/wmerrors.c (modified) (history)

Diff [purge]

Index: trunk/php/wmerrors/wmerrors.c
@@ -12,10 +12,11 @@
1313 #include "ext/standard/file.h" /* for file_globals aka. FG() */
1414 #include "ext/date/php_date.h" /* for php_format_date */
1515 #include "ext/standard/php_smart_str.h" /* for smart_str */
 16+#include "ext/standard/php_string.h" /* for php_basename() */
1617 #include "ext/standard/html.h" /* for php_escape_html_entities */
1718 #include "Zend/zend_builtin_functions.h" /* for zend_fetch_debug_backtrace */
1819
19 -void wmerrors_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
 20+static void wmerrors_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
2021 static void wmerrors_show_message(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args TSRMLS_DC);
2122 static void wmerrors_get_concise_backtrace(smart_str *s TSRMLS_DC);
2223 static void write_full_backtrace(php_stream *logfile_stream);
@@ -117,9 +118,9 @@
118119 static const char* error_type_to_string(int type);
119120 static void wmerrors_log_error(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args TSRMLS_DC);
120121
121 -void wmerrors_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
 122+static void wmerrors_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)
122123 {
123 - smart_str new_filename = {0};
 124+ smart_str new_filename = { NULL };
124125 TSRMLS_FETCH();
125126
126127 /* Do not call the custom error handling if:
@@ -291,7 +292,7 @@
292293 /**
293294 * Write a full backtrace to a stream
294295 */
295 -void write_full_backtrace(php_stream *logfile_stream) {
 296+static void write_full_backtrace(php_stream *logfile_stream) {
296297 zval *trace;
297298 zend_fcall_info fci = empty_fcall_info;
298299 zend_fcall_info_cache fcc = empty_fcall_info_cache;
@@ -338,7 +339,7 @@
339340 long maxlen = PHP_STREAM_COPY_ALL;
340341 char * tmp1, *tmp2;
341342 int tmp1_len, tmp2_len;
342 - smart_str expanded = {0};
 343+ smart_str expanded = { NULL };
343344 va_list my_args;
344345
345346 /* Is there a sane message_file? */
Index: trunk/php/wmerrors/README
@@ -36,14 +36,14 @@
3737
3838 The name of a file to send error reports to. This is similar to PHP's
3939 error_log, except that it provides several additional features. Logging to
40 - a TCP or UDP network socket is supported, using a URL of the form:
 40+ a TCP or UDP network socket is also supported, using a URL of the form:
4141
4242 udp://<host>:<port>
4343 tcp://<host>:<port>
4444
4545 For example:
4646
47 - udp://logger:8420
 47+ udp://logger.example.com:8420
4848
4949 wmerrors.log_backtrace
5050

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82046wmerrors: Use a dirty hack to add concise backtraces (formatted as Foo.php:12...catrope00:35, 13 February 2011
r82112* Use debug_print_backtrace() to make the backtrace, instead of print_r(). Th...tstarling12:21, 14 February 2011

Status & tagging log