Changeset 35


Ignore:
Timestamp:
11/06/10 03:40:15 (13 years ago)
Author:
atzm
Message:
  • get_operator(): fixed error handing (invalid opindex was given)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pymigemo/pymigemo.c

    r34 r35  
    187187Migemo_set_operator(Migemo *self, PyObject *args, PyObject *kwds) 
    188188{ 
    189     PyObject *result; 
     189    PyObject *result = NULL; 
    190190    char     *op; 
    191191    int       index; 
     
    201201    } 
    202202 
    203     if (!result) { 
    204         return NULL; 
    205     } 
    206  
    207203    return result; 
    208204} 
     
    211207Migemo_get_operator(Migemo *self, PyObject *args, PyObject *kwds) 
    212208{ 
    213     PyObject            *result; 
     209    PyObject            *result = NULL; 
    214210    const unsigned char *op; 
    215211    int                  index; 
     
    224220        result = PyString_FromString(op); 
    225221    } 
    226  
    227     if (!result) { 
    228         return NULL; 
     222    else { 
     223        PyErr_SetString(PyExc_ValueError, "invalid opindex"); 
    229224    } 
    230225 
     
    235230Migemo_load(Migemo *self, PyObject *args, PyObject *kwds) 
    236231{ 
    237     PyObject *result; 
     232    PyObject *result = NULL; 
    238233    char     *dict_file; 
    239234    int       dict_id; 
     
    247242    if (dict_file) { 
    248243        result = PyInt_FromLong((long)migemo_load(self->migemo_obj, dict_id, dict_file)); 
    249     } 
    250  
    251     if (!result) { 
    252         return NULL; 
    253244    } 
    254245 
Note: See TracChangeset for help on using the changeset viewer.