From: Nicholas Nethercote Date: Mon, 3 Feb 2003 12:20:07 +0000 (+0000) Subject: Made the setting of VG_(details).avg_translation_sizeB optional, defaulting to X-Git-Tag: svn/VALGRIND_1_9_4~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94e46fbb494533eb15634a747802574dd92766f8;p=thirdparty%2Fvalgrind.git Made the setting of VG_(details).avg_translation_sizeB optional, defaulting to 100 bytes (added VG_DEFAULT_TRANS_SIZEB). Took the now-unnecessary settings out of Nulgrind and CoreCheck. Also made .avg_translation_sizeB a UInt (from an Int), to avoid possibility of negatives. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1413 --- diff --git a/corecheck/cc_main.c b/corecheck/cc_main.c index 1d1e93dd77..b6c3e9660f 100644 --- a/corecheck/cc_main.c +++ b/corecheck/cc_main.c @@ -41,7 +41,6 @@ void SK_(pre_clo_init)(void) VG_(details_copyright_author)( "Copyright (C) 2002, and GNU GPL'd, by Nicholas Nethercote."); VG_(details_bug_reports_to) ("njn25@cam.ac.uk"); - VG_(details_avg_translation_sizeB) ( 100 ); VG_(needs_core_errors)(); diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index 394e57c0e7..a45f660cc6 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -293,7 +293,7 @@ typedef Char* description; Char* copyright_author; Char* bug_reports_to; - Int avg_translation_sizeB; + UInt avg_translation_sizeB; } VgDetails; diff --git a/coregrind/vg_needs.c b/coregrind/vg_needs.c index 2caea8dfc2..a83dcd364a 100644 --- a/coregrind/vg_needs.c +++ b/coregrind/vg_needs.c @@ -43,7 +43,7 @@ VgDetails VG_(details) = { .description = NULL, .copyright_author = NULL, .bug_reports_to = NULL, - .avg_translation_sizeB = 0 + .avg_translation_sizeB = VG_DEFAULT_TRANS_SIZEB, }; VgNeeds VG_(needs) = { @@ -109,15 +109,15 @@ void VG_(sanity_check_needs) ( void) if ((var)==(value)) { \ VG_(printf)("\nSkin error: `%s' not initialised\n", \ VG__STRING(var)); \ - VG_(skin_panic)("Uninitialised needs field\n"); \ + VG_(skin_panic)("Uninitialised details field\n"); \ } + /* Ones that must be set */ CHECK_NOT(VG_(details).name, NULL); /* Nb: .version can be NULL */ CHECK_NOT(VG_(details).description, NULL); CHECK_NOT(VG_(details).copyright_author, NULL); CHECK_NOT(VG_(details).bug_reports_to, NULL); - CHECK_NOT(VG_(details).avg_translation_sizeB, 0); #undef CHECK_NOT #undef INVALID_Bool @@ -138,7 +138,7 @@ DETAILS(Char*, version) DETAILS(Char*, description) DETAILS(Char*, copyright_author) DETAILS(Char*, bug_reports_to) -DETAILS(Int, avg_translation_sizeB) +DETAILS(UInt, avg_translation_sizeB) /*--------------------------------------------------------------------*/ /* Setting needs */ diff --git a/example/ex_main.c b/example/ex_main.c index deac4d595b..38664c668f 100644 --- a/example/ex_main.c +++ b/example/ex_main.c @@ -16,10 +16,6 @@ void SK_(pre_clo_init)() "Copyright (C) 2002, and put in the public domain, by Santa Claus."); VG_(details_bug_reports_to) ("santa.claus@northpole.org"); - /* Adjust this to be closer to reality once you have your skin - working. */ - VG_(details_avg_translation_sizeB) ( 100 ); - /* No needs, no core events to track */ } diff --git a/include/vg_skin.h b/include/vg_skin.h index 6ad3ae664a..72c1392284 100644 --- a/include/vg_skin.h +++ b/include/vg_skin.h @@ -1220,6 +1220,10 @@ extern void VG_(generic_detect_memory_leaks) ( /* ------------------------------------------------------------------ */ /* Details */ +/* Default value for avg_translations_sizeB (in bytes), indicating typical + code expansion of about 6:1. */ +#define VG_DEFAULT_TRANS_SIZEB 100 + /* Information used in the startup message. `name' also determines the string used for identifying suppressions in a suppression file as belonging to this skin. `version' can be NULL, in which case (not @@ -1233,10 +1237,9 @@ extern void VG_(details_description) ( Char* description ); extern void VG_(details_copyright_author) ( Char* copyright_author ); /* Average size of a translation, in bytes, so that the translation - storage machinery can allocate memory appropriately. Not critical. - If you're unsure, set to 100 (indicating typical code expansion of - about 6:1). */ -extern void VG_(details_avg_translation_sizeB) ( Int ); + storage machinery can allocate memory appropriately. Not critical, + setting is optional. */ +extern void VG_(details_avg_translation_sizeB) ( UInt size ); /* String printed if an `sk_assert' assertion fails or VG_(skin_panic) is called. Should probably be an email address. */ diff --git a/none/nl_main.c b/none/nl_main.c index 2f236d6d8f..dc31c81707 100644 --- a/none/nl_main.c +++ b/none/nl_main.c @@ -40,7 +40,6 @@ void SK_(pre_clo_init)(void) VG_(details_copyright_author)( "Copyright (C) 2002, and GNU GPL'd, by Nicholas Nethercote."); VG_(details_bug_reports_to) ("njn25@cam.ac.uk"); - VG_(details_avg_translation_sizeB) ( 100 ); /* No needs, no core events to track */ }