Skip to content

Commit efc81bc

Browse files
committed
Fix [-Wundef] warning in Readline extension
1 parent d1e7e4a commit efc81bc

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

ext/readline/readline.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "readline_cli.h"
2626
#include "readline_arginfo.h"
2727

28-
#if HAVE_LIBREADLINE || HAVE_LIBEDIT
28+
#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
2929

3030
#ifndef HAVE_RL_COMPLETION_MATCHES
3131
#define rl_completion_matches completion_matches
@@ -38,7 +38,7 @@
3838
#include <readline/history.h>
3939
#endif
4040

41-
#if HAVE_RL_CALLBACK_READ_CHAR
41+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
4242

4343
static zval _prepped_callback;
4444

@@ -74,12 +74,12 @@ ZEND_GET_MODULE(readline)
7474

7575
PHP_MINIT_FUNCTION(readline)
7676
{
77-
#if HAVE_LIBREADLINE
77+
#ifdef HAVE_LIBREADLINE
7878
/* libedit don't need this call which set the tty in cooked mode */
7979
using_history();
8080
#endif
8181
ZVAL_UNDEF(&_readline_completion);
82-
#if HAVE_RL_CALLBACK_READ_CHAR
82+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
8383
ZVAL_UNDEF(&_prepped_callback);
8484
#endif
8585
return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU);
@@ -94,7 +94,7 @@ PHP_RSHUTDOWN_FUNCTION(readline)
9494
{
9595
zval_ptr_dtor(&_readline_completion);
9696
ZVAL_UNDEF(&_readline_completion);
97-
#if HAVE_RL_CALLBACK_READ_CHAR
97+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
9898
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
9999
rl_callback_handler_remove();
100100
zval_ptr_dtor(&_prepped_callback);
@@ -170,7 +170,7 @@ PHP_FUNCTION(readline_info)
170170
: ZSTR_CHAR(rl_completion_append_character));
171171
add_assoc_bool(return_value,"completion_suppress_append",rl_completion_suppress_append);
172172
#endif
173-
#if HAVE_ERASE_EMPTY_LINE
173+
#ifdef HAVE_ERASE_EMPTY_LINE
174174
add_assoc_long(return_value,"erase_empty_line",rl_erase_empty_line);
175175
#endif
176176
#ifndef PHP_WIN32
@@ -235,7 +235,7 @@ PHP_FUNCTION(readline_info)
235235
RETVAL_INTERNED_STR(
236236
oldval == 0 ? ZSTR_EMPTY_ALLOC() : ZSTR_CHAR(oldval));
237237
#endif
238-
#if HAVE_ERASE_EMPTY_LINE
238+
#ifdef HAVE_ERASE_EMPTY_LINE
239239
} else if (!strcasecmp(what, "erase_empty_line")) {
240240
oldval = rl_erase_empty_line;
241241
if (value) {
@@ -295,7 +295,7 @@ PHP_FUNCTION(readline_clear_history)
295295
RETURN_THROWS();
296296
}
297297

298-
#if HAVE_LIBEDIT
298+
#ifdef HAVE_LIBEDIT
299299
/* clear_history is the only function where rl_initialize
300300
is not call to ensure correct allocation */
301301
using_history();
@@ -505,7 +505,7 @@ PHP_FUNCTION(readline_completion_function)
505505

506506
/* }}} */
507507

508-
#if HAVE_RL_CALLBACK_READ_CHAR
508+
#ifdef HAVE_RL_CALLBACK_READ_CHAR
509509

510510
static void php_rl_callback_handler(char *the_line)
511511
{
@@ -594,7 +594,7 @@ PHP_FUNCTION(readline_redisplay)
594594
RETURN_THROWS();
595595
}
596596

597-
#if HAVE_LIBEDIT
597+
#ifdef HAVE_LIBEDIT
598598
/* seems libedit doesn't take care of rl_initialize in rl_redisplay
599599
* see bug #72538 */
600600
using_history();
@@ -605,7 +605,7 @@ PHP_FUNCTION(readline_redisplay)
605605

606606
#endif
607607

608-
#if HAVE_RL_ON_NEW_LINE
608+
#ifdef HAVE_RL_ON_NEW_LINE
609609
/* {{{ proto void readline_on_new_line(void)
610610
Inform readline that the cursor has moved to a new line */
611611
PHP_FUNCTION(readline_on_new_line)

ext/readline/readline_cli.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include <unixlib/local.h>
4646
#endif
4747

48-
#if HAVE_LIBEDIT
48+
#ifdef HAVE_LIBEDIT
4949
#include <editline/readline.h>
5050
#else
5151
#include <readline/readline.h>
@@ -663,7 +663,7 @@ static int readline_shell_run(void) /* {{{ */
663663
}
664664

665665
if (history_lines_to_write) {
666-
#if HAVE_LIBEDIT
666+
#ifdef HAVE_LIBEDIT
667667
write_history(history_file);
668668
#else
669669
append_history(history_lines_to_write, history_file);
@@ -746,7 +746,7 @@ PHP_MINIT_FUNCTION(cli_readline)
746746
ZEND_INIT_MODULE_GLOBALS(cli_readline, cli_readline_init_globals, NULL);
747747
REGISTER_INI_ENTRIES();
748748

749-
#if HAVE_LIBEDIT
749+
#ifdef HAVE_LIBEDIT
750750
REGISTER_STRING_CONSTANT("READLINE_LIB", "libedit", CONST_CS|CONST_PERSISTENT);
751751
#else
752752
REGISTER_STRING_CONSTANT("READLINE_LIB", "readline", CONST_CS|CONST_PERSISTENT);

0 commit comments

Comments
 (0)