Skip to content

Commit d9d025e

Browse files
richard-finejoncham
authored andcommitted
Fix compile
1 parent b9afea1 commit d9d025e

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

mono/metadata/profiler.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,17 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
408408
return TRUE;
409409
}
410410

411+
struct InvokeCallbackInfo
412+
{
413+
MonoProfilerCoverageCallback cb;
414+
MonoProfilerHandle handle;
415+
};
416+
411417
static void invoke_coverage_callback_for_hashtable_entry (gpointer key, gpointer value, gpointer user_data)
412418
{
419+
InvokeCallbackInfo* invokeInfo = (InvokeCallbackInfo*) user_data;
413420
MonoMethod* method = (MonoMethod*)key;
414421
MonoProfilerCoverageInfo *info = (MonoProfilerCoverageInfo*)value;
415-
MonoProfilerCoverageCallback cb = (MonoProfilerCoverageCallback)user_data;
416422

417423
MonoError error;
418424
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
@@ -450,7 +456,7 @@ static void invoke_coverage_callback_for_hashtable_entry (gpointer key, gpointer
450456
}
451457
}
452458

453-
cb (handle->prof, &data);
459+
invokeInfo->cb (invokeInfo->handle->prof, &data);
454460

455461
g_free ((char *) data.file_name);
456462
}
@@ -465,23 +471,27 @@ mono_profiler_get_all_coverage_data(MonoProfilerHandle handle, MonoProfilerCover
465471
if (!mono_profiler_state.code_coverage)
466472
return FALSE;
467473

474+
InvokeCallbackInfo info;
475+
info.cb = cb;
476+
info.handle = handle;
477+
468478
coverage_lock ();
469479

470-
g_hash_table_foreach (mono_profiler_state.coverage_hash, invoke_coverage_callback_for_hashtable_entry, cb);
480+
g_hash_table_foreach (mono_profiler_state.coverage_hash, invoke_coverage_callback_for_hashtable_entry, &info);
471481

472482
coverage_unlock ();
473483

474484
return TRUE;
475485
}
476486

477-
void
487+
mono_bool
478488
mono_profiler_reset_coverage(MonoMethod* method)
479489
{
480490
if (!mono_profiler_state.code_coverage)
481-
return;
491+
return FALSE;
482492

483493
if ((method->flags & METHOD_ATTRIBUTE_ABSTRACT) || (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) || (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
484-
return;
494+
return FALSE;
485495

486496
coverage_lock ();
487497

@@ -490,10 +500,12 @@ mono_profiler_reset_coverage(MonoMethod* method)
490500
coverage_unlock ();
491501

492502
if (!info)
493-
return;
503+
return TRUE;
494504

495505
for (guint32 i = 0; i < info->entries; i++)
496506
info->data[i].count = 0;
507+
508+
return TRUE;
497509
}
498510

499511
static void reset_coverage_for_hashtable_entry (gpointer key, gpointer value, gpointer user_data)

0 commit comments

Comments
 (0)