X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=MolLib%2FRuby_bind%2Fruby_bind.c;h=76586367a44f00eab769c5cc45cf702f10f0b3f9;hb=874b25b5b7a0ae7dbcfe9c043447273bf7c546f9;hp=2c0921879e34caab9c3f9d25a343ce1f52dbc854;hpb=388f1f455139811b1c290d55131fcc1aebf6a5cd;p=molby%2FMolby.git diff --git a/MolLib/Ruby_bind/ruby_bind.c b/MolLib/Ruby_bind/ruby_bind.c index 2c09218..7658636 100644 --- a/MolLib/Ruby_bind/ruby_bind.c +++ b/MolLib/Ruby_bind/ruby_bind.c @@ -5396,7 +5396,7 @@ s_Molecule_Savedcd(VALUE self, VALUE fname) static VALUE s_Molecule_LoadSave(int argc, VALUE *argv, VALUE self, int loadFlag) { - VALUE rval; + VALUE rval, argv0; char *argstr, *methname, *p, *type = ""; ID mid = 0; int i; @@ -5406,7 +5406,8 @@ s_Molecule_LoadSave(int argc, VALUE *argv, VALUE self, int loadFlag) if (argc == 0) return Qnil; - if (argc == 0 || (argstr = StringValuePtr(argv[0])) == NULL) + argv0 = argv[0]; /* Keep as a local variable to avoid GC */ + if (argc == 0 || (argstr = StringValuePtr(argv0)) == NULL) rb_raise(rb_eMolbyError, "the first argument must be either filename or \":filetype\""); if (argstr[0] == ':') { /* Call "loadXXX" (or "saveXXX") for type ":XXX" */ @@ -5461,7 +5462,7 @@ s_Molecule_LoadSave(int argc, VALUE *argv, VALUE self, int loadFlag) } } failure: - rval = rb_str_to_str(argv[0]); + rval = rb_str_to_str(argv0); asprintf(&p, "Failed to %s file %s", (loadFlag ? "load" : "save"), type); s_Molecule_RaiseOnLoadSave(1, loadFlag, p, StringValuePtr(rval)); return Qnil; /* Does not reach here */ @@ -5472,7 +5473,7 @@ success: Molecule *mol; /* Atom *ap; */ Data_Get_Struct(self, Molecule, mol); - MoleculeSetPath(mol, StringValuePtr(argv[0])); + MoleculeSetPath(mol, StringValuePtr(argv0)); /* Check if all occupancy factors are zero; if that is the case, then all set to 1.0 */ /* for (i = 0, ap = mol->atoms; i < mol->natoms; i++, ap = ATOM_NEXT(ap)) { @@ -12383,7 +12384,9 @@ Molby_getDescription(char **versionString, char **auxString) "%s\n" "FFTW 3.3.2, http://www.fftw.org/\n" " Copyright (C) 2003, 2007-11 Matteo Frigo" - " and Massachusetts Institute of Technology", + " and Massachusetts Institute of Technology\n" + "JANPA 2.01, https://janpa.sourceforge.net/\n" + " Copyright (C) 2014, Tymofii Nikolaienko", MyAppCallback_getGUIDescriptionString(), gRubyVersion, gRubyCopyright); } else { @@ -12393,7 +12396,9 @@ Molby_getDescription(char **versionString, char **auxString) "%s\n" "FFTW 3.3.2, http://www.fftw.org/\n" " Copyright (C) 2003, 2007-11 Matteo Frigo" - " and Massachusetts Institute of Technology", + " and Massachusetts Institute of Technology\n" + "JANPA 2.01, https://janpa.sourceforge.net/\n" + " Copyright (C) 2014, Tymofii Nikolaienko", gRubyVersion, gRubyCopyright); }