Branch: Tag:

2016-12-09

2016-12-09 11:00:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

MasterObject: Survive older pike 8.0 binaries.

DefaultCompilerEnvironment->lock() doesn't exist
in older versions of Pike 8.0.

Potential fix for such binaries failing with recent master.pike.

1364:    return (all_constants()["describe_error"]||describe_error)(err);   }    + protected object lock_compiler() + { +  // Compat with older Pike 8.0 binaries. +  if (DefaultCompilerEnvironment->lock) { +  return DefaultCompilerEnvironment->lock(); +  } +  return UNDEFINED; + } +    protected program low_findprog(string pname,    string ext,    object|void handler,
1417:    }   #endif    -  object compiler_lock = DefaultCompilerEnvironment->lock(); +  object compiler_lock = lock_compiler();    if(!undefinedp(ret = programs[fname]) && (ret != no_value)) {    destruct(compiler_lock);    resolv_debug("low_findprog %s: returning cached (from other thread).\n",
1563:   void unregister(program p)   {    // werror("Unregistering %O...\n", p); -  object compiler_lock = DefaultCompilerEnvironment->lock(); +  object compiler_lock = lock_compiler();       if(string fname=rev_programs[p] || search(programs,p)) {    resolv_debug("unregister %s\n", fname);
1902:    p = low_cast_to_program(oname, current_file, current_handler, 1);    if(!p) return 0;    if(!objectp(o = objects[p])) { -  object compiler_lock = DefaultCompilerEnvironment->lock(); +  object compiler_lock = lock_compiler();    // NB: p might be a function in a fake_object...    if(!objectp(o = objects[p])) o = objects[p] = p();    destruct(compiler_lock);
2154:    object o;    // NB: p might be a function in a fake_object...    if(!objectp(o = objects[ret])) { -  object compiler_lock = DefaultCompilerEnvironment->lock(); +  object compiler_lock = lock_compiler();    if(!objectp(o = objects[ret])) o = objects[ret] = ret();    destruct(compiler_lock);    }