Skip to content

Commit 70d8a69

Browse files
committed
Fix compiler warning with glibc 2.43 support of C23 const-preserving standard library macros: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
See https://sourceware.org/cgit/glibc/commit/?id=cd748a63ab1
1 parent cbe6eb3 commit 70d8a69

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

ext/mysqlnd/mysqlnd_alloc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static void _mysqlnd_efree(void *ptr MYSQLND_MEM_D)
199199

200200
#if PHP_DEBUG
201201
{
202-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
202+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
203203
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
204204
}
205205
#endif
@@ -230,7 +230,7 @@ static void _mysqlnd_pefree(void *ptr, bool persistent MYSQLND_MEM_D)
230230

231231
#if PHP_DEBUG
232232
{
233-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
233+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
234234
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
235235
}
236236
#endif
@@ -262,7 +262,7 @@ static char * _mysqlnd_pememdup(const char * const ptr, size_t length, bool pers
262262

263263
#if PHP_DEBUG
264264
{
265-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
265+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
266266
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
267267
}
268268
#endif
@@ -293,7 +293,7 @@ static char * _mysqlnd_pestrndup(const char * const ptr, size_t length, bool per
293293

294294
#if PHP_DEBUG
295295
{
296-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
296+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
297297
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
298298
}
299299
#endif
@@ -334,7 +334,7 @@ static char * _mysqlnd_pestrdup(const char * const ptr, bool persistent MYSQLND_
334334
TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name);
335335
#if PHP_DEBUG
336336
{
337-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
337+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
338338
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
339339
}
340340
#endif

ext/mysqlnd/mysqlnd_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_scheme)(MYSQLND_CONN_DATA * conn, MYSQLND_
550550
/* IPv6 without square brackets so without port */
551551
transport.l = mnd_sprintf(&transport.s, 0, "tcp://[%s]:%u", hostname.s, port);
552552
} else {
553-
char *p;
553+
const char *p;
554554

555555
/* IPv6 addresses are in the format [address]:port */
556556
if (hostname.s[0] == '[') { /* IPv6 */

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ php_mysqlnd_greet_read(MYSQLND_CONN_DATA * conn, void * _packet)
459459
packet->auth_protocol = estrdup("");
460460
} else {
461461
/* Check if NUL present */
462-
char *null_terminator = memchr(p, '\0', remaining_size);
462+
const char *null_terminator = memchr(p, '\0', remaining_size);
463463
size_t auth_protocol_len;
464464
if (null_terminator) {
465465
/* If present, do basically estrdup */

0 commit comments

Comments
 (0)