Skip to content

Commit 64f25ad

Browse files
committed
Remove -Wunused-result warnings
1 parent b17ecc1 commit 64f25ad

File tree

8 files changed

+24
-25
lines changed

8 files changed

+24
-25
lines changed

sapi/phpdbg/phpdbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ int main(int argc, char **argv) /* {{{ */
18141814
if (PHPDBG_G(ops)) {
18151815
phpdbg_print_opcodes(print_opline_func);
18161816
} else {
1817-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("No opcodes could be compiled | No file specified or compilation failed?\n"));
1817+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("No opcodes could be compiled | No file specified or compilation failed?\n"));
18181818
}
18191819
goto phpdbg_out;
18201820
}

sapi/phpdbg/phpdbg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@
113113
#define memcpy(...) memcpy_tmp(__VA_ARGS__)
114114
#endif
115115

116+
#define quiet_write(...) ZEND_IGNORE_VALUE(write(__VA_ARGS__))
117+
116118
#if !defined(PHPDBG_WEBDATA_TRANSFER_H) && !defined(PHPDBG_WEBHELPER_H)
117119

118120
#ifdef ZTS

sapi/phpdbg/phpdbg_bp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,12 @@ PHPDBG_API void phpdbg_resolve_op_array_breaks(zend_op_array *op_array) /* {{{ *
533533
opline_break = zend_hash_get_current_data_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
534534

535535
phpdbg_notice("breakpoint", "add=\"success\" id=\"%d\" symbol=\"%s\" num=\"%ld\" opline=\"%#lx\"", "Breakpoint #%d resolved at %s%s%s#%ld (opline %#lx)",
536-
brake->id,
536+
opline_break->id,
537537
brake->class_name ? brake->class_name : "",
538538
brake->class_name && brake->func_name ? "::" : "",
539539
brake->func_name ? brake->func_name : "",
540540
brake->opline_num,
541-
brake->opline);
541+
opline_break->opline);
542542
}
543543
} ZEND_HASH_FOREACH_END();
544544
} /* }}} */

sapi/phpdbg/phpdbg_cmd.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,35 +95,35 @@ PHPDBG_API char* phpdbg_param_tostring(const phpdbg_param_t *param, char **point
9595
{
9696
switch (param->type) {
9797
case STR_PARAM:
98-
asprintf(pointer, "%s", param->str);
98+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s", param->str));
9999
break;
100100

101101
case ADDR_PARAM:
102-
asprintf(pointer, ZEND_ULONG_FMT, param->addr);
102+
ZEND_IGNORE_VALUE(asprintf(pointer, ZEND_ULONG_FMT, param->addr));
103103
break;
104104

105105
case NUMERIC_PARAM:
106-
asprintf(pointer, "%li", param->num);
106+
ZEND_IGNORE_VALUE(asprintf(pointer, "%li", param->num));
107107
break;
108108

109109
case METHOD_PARAM:
110-
asprintf(pointer, "%s::%s", param->method.class, param->method.name);
110+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s::%s", param->method.class, param->method.name));
111111
break;
112112

113113
case FILE_PARAM:
114114
if (param->num) {
115-
asprintf(pointer, "%s:%lu#%lu", param->file.name, param->file.line, param->num);
115+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s:%lu#%lu", param->file.name, param->file.line, param->num));
116116
} else {
117-
asprintf(pointer, "%s:%lu", param->file.name, param->file.line);
117+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s:%lu", param->file.name, param->file.line));
118118
}
119119
break;
120120

121121
case NUMERIC_FUNCTION_PARAM:
122-
asprintf(pointer, "%s#%lu", param->str, param->num);
122+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s#%lu", param->str, param->num));
123123
break;
124124

125125
case NUMERIC_METHOD_PARAM:
126-
asprintf(pointer, "%s::%s#%lu", param->method.class, param->method.name, param->num);
126+
ZEND_IGNORE_VALUE(asprintf(pointer, "%s::%s#%lu", param->method.class, param->method.name, param->num));
127127
break;
128128

129129
default:

sapi/phpdbg/phpdbg_io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ PHPDBG_API int phpdbg_consume_bytes(int sock, char *ptr, int len, int tmo) {
149149
#endif
150150

151151
if (got_now == -1) {
152-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Read operation timed out!\n"));
152+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Read operation timed out!\n"));
153153
return -1;
154154
}
155155
i -= got_now;
@@ -270,7 +270,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
270270

271271
wrote = snprintf(buf, 128, "Could not translate address '%s'", addr);
272272
buf[wrote] = '\0';
273-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
273+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
274274

275275
return sock;
276276
} else {
@@ -280,7 +280,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
280280

281281
wrote = snprintf(buf, 256, "Host '%s' not found. %s", addr, estrdup(gai_strerror(rc)));
282282
buf[wrote] = '\0';
283-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
283+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
284284

285285
return sock;
286286
#ifndef PHP_WIN32
@@ -295,7 +295,7 @@ PHPDBG_API int phpdbg_create_listenable_socket(const char *addr, unsigned short
295295

296296
wrote = sprintf(buf, "Unable to create socket");
297297
buf[wrote] = '\0';
298-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
298+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, buf, strlen(buf));
299299

300300
return sock;
301301
}

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) /
350350
char *sys_ini;
351351
int i;
352352

353-
asprintf(&sys_ini, "%s/" PHPDBG_INIT_FILENAME, PHP_CONFIG_FILE_PATH);
353+
ZEND_IGNORE_VALUE(asprintf(&sys_ini, "%s/" PHPDBG_INIT_FILENAME, PHP_CONFIG_FILE_PATH));
354354
phpdbg_try_file_init(sys_ini, strlen(sys_ini), 0);
355355
free(sys_ini);
356356

@@ -369,7 +369,7 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default) /
369369
scan_dir[i] = 0;
370370
}
371371

372-
asprintf(&init_file, "%s/%s", scan_dir, PHPDBG_INIT_FILENAME);
372+
ZEND_IGNORE_VALUE(asprintf(&init_file, "%s/%s", scan_dir, PHPDBG_INIT_FILENAME));
373373
phpdbg_try_file_init(init_file, strlen(init_file), 1);
374374
if (i == -1) {
375375
break;

sapi/phpdbg/phpdbg_sigsafe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ static void* zend_mm_mem_alloc(zend_mm_storage *storage, size_t size, size_t ali
1313
return PHPDBG_G(sigsafe_mem).mem;
1414
}
1515

16-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));
16+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Tried to allocate more than " EXP_STR(PHPDBG_SIGSAFE_MEM_SIZE) " bytes from stack memory in signal handler ... bailing out of signal handler\n"));
1717

1818
if (*EG(bailout)) {
1919
LONGJMP(*EG(bailout), FAILURE);
2020
}
2121

22-
write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Bailed out without a bailout address in signal handler!\n"));
22+
quiet_write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("Bailed out without a bailout address in signal handler!\n"));
2323

2424
return NULL;
2525
}

sapi/phpdbg/phpdbg_utils.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,13 @@ PHPDBG_API const char *phpdbg_get_prompt(void) /* {{{ */
302302
#ifndef HAVE_LIBEDIT
303303
/* TODO: libedit doesn't seems to support coloured prompt */
304304
if ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED)) {
305-
asprintf(
306-
&PHPDBG_G(prompt)[1], "\033[%sm%s\033[0m ",
305+
ZEND_IGNORE_VALUE(asprintf(&PHPDBG_G(prompt)[1], "\033[%sm%s\033[0m ",
307306
PHPDBG_G(colors)[PHPDBG_COLOR_PROMPT]->code,
308-
PHPDBG_G(prompt)[0]);
307+
PHPDBG_G(prompt)[0]));
309308
} else
310309
#endif
311310
{
312-
asprintf(
313-
&PHPDBG_G(prompt)[1], "%s ",
314-
PHPDBG_G(prompt)[0]);
311+
ZEND_IGNORE_VALUE(asprintf(&PHPDBG_G(prompt)[1], "%s ", PHPDBG_G(prompt)[0]));
315312
}
316313

317314
return PHPDBG_G(prompt)[1];

0 commit comments

Comments
 (0)