Skip to content

Commit 3d84b8f

Browse files
committed
Zend: voidify init_ini_scanner()
It now always returns SUCCESS, and propagate the voidification chain for call sites of init_ini_scanner that now always return SUCCESS.
1 parent f7c1a38 commit 3d84b8f

3 files changed

Lines changed: 6 additions & 18 deletions

File tree

‎Zend/zend_ini_parser.y‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ ZEND_API zend_result zend_parse_ini_string(const char *str, bool unbuffered_erro
255255
ini_parser_param.arg = arg;
256256
CG(ini_parser_param) = &ini_parser_param;
257257

258-
if (zend_ini_prepare_string_for_scanning(str, scanner_mode) == FAILURE) {
259-
return FAILURE;
260-
}
258+
zend_ini_prepare_string_for_scanning(str, scanner_mode);
261259

262260
CG(ini_parser_unbuffered_errors) = unbuffered_errors;
263261
retval = ini_parse();

‎Zend/zend_ini_scanner.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ BEGIN_EXTERN_C()
3434
ZEND_COLD uint32_t zend_ini_scanner_get_lineno(void);
3535
ZEND_COLD const char *zend_ini_scanner_get_filename(void);
3636
zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, zend_ini_scanner_mode scanner_mode);
37-
zend_result zend_ini_prepare_string_for_scanning(const char *str, zend_ini_scanner_mode scanner_mode);
37+
void zend_ini_prepare_string_for_scanning(const char *str, zend_ini_scanner_mode scanner_mode);
3838
int ini_lex(zval *ini_lval);
3939
void shutdown_ini_scanner(void);
4040
END_EXTERN_C()

‎Zend/zend_ini_scanner.l‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void yy_scan_buffer(const char *str, unsigned int len)
192192

193193
#define ini_filename SCNG(filename)
194194

195-
static zend_result init_ini_scanner(zend_ini_scanner_mode scanner_mode, zend_file_handle *fh)
195+
static void init_ini_scanner(zend_ini_scanner_mode scanner_mode, zend_file_handle *fh)
196196
{
197197
SCNG(lineno) = 1;
198198
SCNG(scanner_mode) = scanner_mode;
@@ -206,8 +206,6 @@ static zend_result init_ini_scanner(zend_ini_scanner_mode scanner_mode, zend_fil
206206

207207
zend_stack_init(&SCNG(state_stack), sizeof(int));
208208
BEGIN(INITIAL);
209-
210-
return SUCCESS;
211209
}
212210

213211
/* {{{ shutdown_ini_scanner() */
@@ -234,7 +232,6 @@ ZEND_COLD const char *zend_ini_scanner_get_filename(void)
234232
}
235233
/* }}} */
236234

237-
/* {{{ zend_ini_open_file_for_scanning() */
238235
zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, zend_ini_scanner_mode scanner_mode)
239236
{
240237
char *buf;
@@ -244,27 +241,20 @@ zend_result zend_ini_open_file_for_scanning(zend_file_handle *fh, zend_ini_scann
244241
return FAILURE;
245242
}
246243

247-
if (init_ini_scanner(scanner_mode, fh) == FAILURE) {
248-
return FAILURE;
249-
}
244+
init_ini_scanner(scanner_mode, fh);
250245

251246
yy_scan_buffer(buf, (unsigned int)size);
252247

253248
return SUCCESS;
254249
}
255-
/* }}} */
256250

257-
zend_result zend_ini_prepare_string_for_scanning(const char *str, zend_ini_scanner_mode scanner_mode)
251+
void zend_ini_prepare_string_for_scanning(const char *str, zend_ini_scanner_mode scanner_mode)
258252
{
259253
int len = (int)strlen(str);
260254

261-
if (init_ini_scanner(scanner_mode, NULL) == FAILURE) {
262-
return FAILURE;
263-
}
255+
init_ini_scanner(scanner_mode, NULL);
264256

265257
yy_scan_buffer(str, len);
266-
267-
return SUCCESS;
268258
}
269259

270260
/* {{{ zend_ini_escape_string() */

0 commit comments

Comments
 (0)