Skip to content

Commit a418192

Browse files
committed
Review feedback.
1 parent 8d448d2 commit a418192

File tree

8 files changed

+20
-18
lines changed

8 files changed

+20
-18
lines changed

src/mono/mono/eglib/eglib-remap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
#define g_usleep monoeg_g_usleep
262262
#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
263263
#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
264+
#define g_utf16_to_utf8_custom_alloc monoeg_g_utf16_to_utf8_custom_alloc
264265
#define g_utf16_ascii_equal monoeg_g_utf16_ascii_equal
265266
#define g_utf16_asciiz_equal monoeg_g_utf16_asciiz_equal
266267
#define g_utf8_jump_table monoeg_g_utf8_jump_table
@@ -272,6 +273,7 @@
272273
#define g_utf8_strup monoeg_g_utf8_strup
273274
#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
274275
#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
276+
#define g_utf8_to_utf16_custom_alloc monoeg_g_utf8_to_utf16_custom_alloc
275277
#define g_utf8_validate monoeg_g_utf8_validate
276278
#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
277279
#define g_unichar_is_space monoeg_g_unichar_is_space

src/mono/mono/eglib/giconv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
919919

920920
error:
921921
if (errno == ENOMEM) {
922-
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ALLOC_FAILED,
922+
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_MEMORY,
923923
"Allocation failed.");
924924
} else if (errno == EILSEQ) {
925925
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
@@ -1103,7 +1103,7 @@ g_utf16_to_utf8_general (const gunichar2 *str, glong len, glong *items_read, glo
11031103
outptr = outbuf = custom_alloc_func (outlen + 1, custom_alloc_data);
11041104

11051105
if (G_UNLIKELY (custom_alloc_func && !outbuf)) {
1106-
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ALLOC_FAILED, "Allocation failed.");
1106+
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_MEMORY, "Allocation failed.");
11071107
if (items_written)
11081108
*items_written = 0;
11091109
return NULL;

src/mono/mono/eglib/glib.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ typedef enum {
10051005
G_CONVERT_ERROR_PARTIAL_INPUT,
10061006
G_CONVERT_ERROR_BAD_URI,
10071007
G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
1008-
G_CONVERT_ERROR_ALLOC_FAILED
1008+
G_CONVERT_ERROR_NO_MEMORY
10091009
} GConvertError;
10101010

10111011
gchar *g_utf8_strup (const gchar *str, gssize len);
@@ -1038,21 +1038,21 @@ typedef struct {
10381038
gpointer buffer;
10391039
gsize buffer_size;
10401040
gsize req_buffer_size;
1041-
} GConvertDefaultCustomAllocatorData;
1041+
} GConvertFixedBufferCustomAllocatorData;
10421042

10431043
static
10441044
gpointer
1045-
g_converter_default_custom_allocator_func (gsize req_size, gpointer custom_alloc_data)
1045+
g_converter_fixed_buffer_custom_allocator_func (gsize req_size, gpointer custom_alloc_data)
10461046
{
1047-
GConvertDefaultCustomAllocatorData *default_custom_alloc_data = (GConvertDefaultCustomAllocatorData *)custom_alloc_data;
1048-
if (!default_custom_alloc_data)
1047+
GConvertFixedBufferCustomAllocatorData *fixed_buffer_custom_alloc_data = (GConvertFixedBufferCustomAllocatorData *)custom_alloc_data;
1048+
if (!fixed_buffer_custom_alloc_data)
10491049
return NULL;
10501050

1051-
default_custom_alloc_data->req_buffer_size = req_size;
1052-
if (req_size > default_custom_alloc_data->buffer_size)
1051+
fixed_buffer_custom_alloc_data->req_buffer_size = req_size;
1052+
if (req_size > fixed_buffer_custom_alloc_data->buffer_size)
10531053
return NULL;
10541054

1055-
return default_custom_alloc_data->buffer;
1055+
return fixed_buffer_custom_alloc_data->buffer;
10561056
}
10571057

10581058
gunichar2 *g_utf8_to_utf16_custom_alloc (const gchar *str, glong len, glong *items_read, glong *items_written, GConvertCustomAllocator custom_alloc_func, gpointer custom_alloc_data, GError **err);

src/mono/mono/eglib/gmodule-win32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ g_module_address (void *addr, char *file_name, size_t file_name_len,
172172
DWORD bytes = GetModuleFileNameW (module, fname, G_N_ELEMENTS (fname));
173173
if (bytes) {
174174
/* Convert back to UTF-8 from wide for runtime */
175-
GConvertDefaultCustomAllocatorData custom_alloc_data;
175+
GConvertFixedBufferCustomAllocatorData custom_alloc_data;
176176
custom_alloc_data.buffer = file_name;
177177
custom_alloc_data.buffer_size = file_name_len;
178178
custom_alloc_data.req_buffer_size = 0;
179-
if (!g_utf16_to_utf8_custom_alloc (fname, -1, NULL, NULL, g_converter_default_custom_allocator_func, &custom_alloc_data, NULL))
179+
if (!g_utf16_to_utf8_custom_alloc (fname, -1, NULL, NULL, g_converter_fixed_buffer_custom_allocator_func, &custom_alloc_data, NULL))
180180
*file_name = '\0';
181181
} else {
182182
*file_name = '\0';

src/mono/mono/eventpipe/ep-rt-mono.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,17 @@ write_buffer_string_utf8_t (
607607
if (!value)
608608
return true;
609609

610-
GConvertDefaultCustomAllocatorData custom_alloc_data;
610+
GConvertFixedBufferCustomAllocatorData custom_alloc_data;
611611
custom_alloc_data.buffer = *buffer + *offset;
612612
custom_alloc_data.buffer_size = *size - *offset;
613613
custom_alloc_data.req_buffer_size = 0;
614614

615-
if (!g_utf8_to_utf16_custom_alloc (value, -1, NULL, NULL, g_converter_default_custom_allocator_func, &custom_alloc_data, NULL)) {
615+
if (!g_utf8_to_utf16_custom_alloc (value, -1, NULL, NULL, g_converter_fixed_buffer_custom_allocator_func, &custom_alloc_data, NULL)) {
616616
ep_raise_error_if_nok (resize_buffer (buffer, size, *offset, *size + custom_alloc_data.req_buffer_size, fixed_buffer));
617617
custom_alloc_data.buffer = *buffer + *offset;
618618
custom_alloc_data.buffer_size = *size - *offset;
619619
custom_alloc_data.req_buffer_size = 0;
620-
ep_raise_error_if_nok (g_utf8_to_utf16_custom_alloc (value, -1, NULL, NULL, g_converter_default_custom_allocator_func, &custom_alloc_data, NULL) != NULL);
620+
ep_raise_error_if_nok (g_utf8_to_utf16_custom_alloc (value, -1, NULL, NULL, g_converter_fixed_buffer_custom_allocator_func, &custom_alloc_data, NULL) != NULL);
621621
}
622622

623623
*offset += custom_alloc_data.req_buffer_size;

src/mono/mono/metadata/domain-internals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, gpointer add
668668
typedef void (*MonoJitInfoFunc) (MonoJitInfo *ji, gpointer user_data);
669669

670670
void
671-
jit_info_table_foreach (MonoDomain *domain, MonoJitInfoFunc func, gpointer user_data);
671+
mono_jit_info_table_foreach_internal (MonoDomain *domain, MonoJitInfoFunc func, gpointer user_data);
672672

673673
void mono_enable_debug_domain_unload (gboolean enable);
674674

src/mono/mono/metadata/icall-eventpipe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ eventpipe_execute_rundown (
462462
events_data.buffer_size = 1024 * sizeof(uint32_t);
463463
events_data.buffer = g_new (uint8_t, events_data.buffer_size);
464464
events_data.method_events_func = method_events_func;
465-
jit_info_table_foreach (root_domain, eventpipe_fire_method_events_func, &events_data);
465+
mono_jit_info_table_foreach_internal (root_domain, eventpipe_fire_method_events_func, &events_data);
466466
g_free (events_data.buffer);
467467

468468
// Iterate all assemblies in domain.

src/mono/mono/metadata/jit-info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ mono_jit_info_table_find (MonoDomain *domain, gpointer addr)
338338
}
339339

340340
void
341-
jit_info_table_foreach (MonoDomain *domain, MonoJitInfoFunc func, gpointer user_data)
341+
mono_jit_info_table_foreach_internal (MonoDomain *domain, MonoJitInfoFunc func, gpointer user_data)
342342
{
343343
MonoJitInfoTable *table;
344344
MonoJitInfo *ji;

0 commit comments

Comments
 (0)