Changeset 15646

Show
Ignore:
Timestamp:
22.05.2008 15:46:47 (11 years ago)
Author:
mdewsnip
Message:

Removed a big block of duplicate code.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/lib/gdbmclass.cpp

    r15644 r15646  
    253253  } 
    254254 
    255   // store the value 
    256   datum key_data; 
    257   datum data_data; 
    258  
    259   // get a utf-8 encoded c string of the unicode key 
    260   key_data.dptr = (to_utf8(key)).getcstr(); 
    261   if (key_data.dptr == NULL) { 
    262     if (logout != NULL) (*logout) << "gdbmclass: out of memory\n"; 
    263     return false; 
    264   } 
    265   key_data.dsize = strlen (key_data.dptr); 
    266  
    267   data_data.dptr = (to_utf8(data)).getcstr(); 
    268   if (data_data.dptr == NULL) { 
    269     if (logout != NULL) (*logout) << "gdbmclass: out of memory\n"; 
    270     delete []key_data.dptr; 
    271     return false; 
    272   } 
    273   data_data.dsize = strlen (data_data.dptr); 
    274  
    275   int ret = gdbm_store (gdbmfile, key_data, data_data, GDBM_REPLACE); 
    276   delete []key_data.dptr; 
    277   delete []data_data.dptr; 
    278  
    279   return (ret == 0); 
     255  return setinfo(key, data); 
    280256} 
    281257