Merge branch 'msort-cheri' into 'main'

Allow using msort_r CHERI-enabled architectures

See merge request GNOME/glib!3243
This commit is contained in:
Philip Withnall 2023-02-06 14:04:18 +00:00
commit 361745149f
2 changed files with 9 additions and 13 deletions

View File

@ -128,23 +128,23 @@ msort_with_tmp (const struct msort_param *p, void *b, size_t n)
case 2:
while (n1 > 0 && n2 > 0)
{
unsigned long *tmpl = (unsigned long *) tmp;
unsigned long *bl;
guintptr *tmpl = (guintptr *) tmp;
guintptr *bl;
tmp += s;
if ((*cmp) (b1, b2, arg) <= 0)
{
bl = (unsigned long *) b1;
bl = (guintptr *) b1;
b1 += s;
--n1;
}
else
{
bl = (unsigned long *) b2;
bl = (guintptr *) b2;
b2 += s;
--n2;
}
while (tmpl < (unsigned long *) tmp)
while (tmpl < (guintptr *) tmp)
*tmpl++ = *bl++;
}
break;
@ -265,15 +265,15 @@ msort_r (void *b, size_t n, size_t s, GCompareDataFunc cmp, void *arg)
else
{
if ((s & (sizeof (guint32) - 1)) == 0
&& (guintptr) b % ALIGNOF_GUINT32 == 0)
&& (gsize) (guintptr) b % G_ALIGNOF(guint32) == 0)
{
if (s == sizeof (guint32))
p.var = 0;
else if (s == sizeof (guint64)
&& (guintptr) b % ALIGNOF_GUINT64 == 0)
&& (gsize) (guintptr) b % G_ALIGNOF(guint64) == 0)
p.var = 1;
else if ((s & (sizeof (unsigned long) - 1)) == 0
&& (guintptr) b % ALIGNOF_UNSIGNED_LONG == 0)
else if ((s & (sizeof (void *) - 1)) == 0
&& (gsize) (guintptr) b % G_ALIGNOF(void *) == 0)
p.var = 2;
}
msort_with_tmp (&p, b, n);

View File

@ -1479,8 +1479,6 @@ long_long_align = cc.alignment('long long')
# be 64-bit in C99, and it is available on all supported compilers
sizet_align = cc.alignment('size_t')
glib_conf.set('ALIGNOF_UNSIGNED_LONG', long_align)
glib_conf.set('SIZEOF_CHAR', char_size)
glib_conf.set('SIZEOF_INT', int_size)
glib_conf.set('SIZEOF_SHORT', short_size)
@ -1534,7 +1532,6 @@ glibconfig_conf.set('gint32', gint32)
glibconfig_conf.set_quoted('gint32_modifier', gint32_modifier)
glibconfig_conf.set_quoted('gint32_format', gint32_format)
glibconfig_conf.set_quoted('guint32_format', guint32_format)
glib_conf.set('ALIGNOF_GUINT32', guint32_align)
if int_size == 8
gint64 = 'int'
@ -1573,7 +1570,6 @@ glibconfig_conf.set_quoted('gint64_format', gint64_format)
glibconfig_conf.set_quoted('guint64_format', guint64_format)
glibconfig_conf.set('gint64_constant', gint64_constant)
glibconfig_conf.set('guint64_constant', guint64_constant)
glib_conf.set('ALIGNOF_GUINT64', guint64_align)
if host_system == 'windows'
glibconfig_conf.set('g_pid_type', 'void*')