Ticket #1383: hash_seed_option.patch

File hash_seed_option.patch, 1.9 KB (added by cotto, 5 years ago)

first version of the patch

  • src/string/api.c

     
    290290    if (interp->parent_interpreter) { 
    291291        interp->hash_seed = interp->parent_interpreter->hash_seed; 
    292292    } 
    293     else { 
     293    /* interp is initialized from zeroed memory, so this is fine */ 
     294    else if (interp->hash_seed == 0) { 
    294295        /* TT #64 - use an entropy source once available */ 
    295296        Parrot_srand(Parrot_intval_time()); 
    296297        interp->hash_seed = Parrot_uint_rand(0); 
  • compilers/imcc/main.c

     
    218218    "    -h --help\n" 
    219219    "    -V --version\n" 
    220220    "    -I --include add path to include search\n" 
     221    "    -H --hash-seed specify hex value to use as hash seed\n" 
    221222    "    -L --library add path to library search\n" 
    222223    "    -X --dynext add path to dynamic extension search\n" 
    223224    "   <Run core options>\n" 
     
    292293    { 'D', 'D', OPTION_optional_FLAG, { "--parrot-debug" } }, 
    293294    { 'E', 'E', (OPTION_flags)0, { "--pre-process-only" } }, 
    294295    { 'G', 'G', (OPTION_flags)0, { "--no-gc" } }, 
     296    { 'H', 'H', OPTION_required_FLAG, { "--hash-seed" } }, 
    295297    { 'I', 'I', OPTION_required_FLAG, { "--include" } }, 
    296298    { 'L', 'L', OPTION_required_FLAG, { "--library" } }, 
    297299    { 'O', 'O', OPTION_optional_FLAG, { "--optimize" } }, 
     
    427429          case 'G': 
    428430            IMCC_INFO(interp)->gc_off = 1; 
    429431            break; 
     432          case 'H': 
     433            if (opt.opt_arg && is_all_hex_digits(opt.opt_arg)) { 
     434                interp->hash_seed = strtoul(opt.opt_arg, NULL, 16); 
     435            } 
     436            break; 
    430437          case '.':  /* Give Windows Parrot hackers an opportunity to 
    431438                      * attach a debuggger. */ 
    432439            fgetc(stdin);