Skip to content

Commit d0e92ae

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 ac86e10 commit d0e92ae

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
@@ -201,7 +201,7 @@ static void _mysqlnd_efree(void *ptr MYSQLND_MEM_D)
201201

202202
#if PHP_DEBUG
203203
{
204-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
204+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
205205
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
206206
}
207207
#endif
@@ -232,7 +232,7 @@ static void _mysqlnd_pefree(void *ptr, bool persistent MYSQLND_MEM_D)
232232

233233
#if PHP_DEBUG
234234
{
235-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
235+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
236236
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
237237
}
238238
#endif
@@ -264,7 +264,7 @@ static char * _mysqlnd_pememdup(const char * const ptr, size_t length, bool pers
264264

265265
#if PHP_DEBUG
266266
{
267-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
267+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
268268
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
269269
}
270270
#endif
@@ -295,7 +295,7 @@ static char * _mysqlnd_pestrndup(const char * const ptr, size_t length, bool per
295295

296296
#if PHP_DEBUG
297297
{
298-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
298+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
299299
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
300300
}
301301
#endif
@@ -336,7 +336,7 @@ static char * _mysqlnd_pestrdup(const char * const ptr, bool persistent MYSQLND_
336336
TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name);
337337
#if PHP_DEBUG
338338
{
339-
char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
339+
const char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR);
340340
TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno);
341341
}
342342
#endif

ext/mysqlnd/mysqlnd_connection.c

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

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

ext/mysqlnd/mysqlnd_wireprotocol.c

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

0 commit comments

Comments
 (0)