Changeset 1438 for pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h
- Timestamp:
- Sep 17, 2007 3:44:47 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h
r1430 r1438 29 29 pj_str_t str; 30 30 31 str.ptr = PyString_AS_STRING(obj); 32 str.slen = PyString_GET_SIZE(obj); 31 if (obj) { 32 str.ptr = PyString_AS_STRING(obj); 33 str.slen = PyString_GET_SIZE(obj); 34 } else { 35 str.ptr = NULL; 36 str.slen = 0; 37 } 33 38 34 39 return str; … … 1906 1911 cfg->force_contact.slen); 1907 1912 Py_XDECREF(obj->proxy); 1908 obj->proxy = (PyListObject *)PyList_New( 8);1913 obj->proxy = (PyListObject *)PyList_New(0); 1909 1914 for (i=0; i<cfg->proxy_cnt; ++i) { 1910 1915 PyObject * str; 1911 1916 str = PyString_FromStringAndSize(cfg->proxy[i].ptr, 1912 1917 cfg->proxy[i].slen); 1913 PyList_ SetItem((PyObject *)obj->proxy, i, str);1918 PyList_Append((PyObject *)obj->proxy, str); 1914 1919 } 1915 1920 … … 1917 1922 1918 1923 Py_XDECREF(obj->cred_info); 1919 obj->cred_info = (PyListObject *)PyList_New( 8);1924 obj->cred_info = (PyListObject *)PyList_New(0); 1920 1925 for (i=0; i<cfg->cred_count; ++i) { 1921 1926 PyObj_pjsip_cred_info * ci; … … 1924 1929 PyObj_pjsip_cred_info_new(&PyTyp_pjsip_cred_info,NULL,NULL); 1925 1930 PyObj_pjsip_cred_info_import(ci, &cfg->cred_info[i]); 1926 PyList_ SetItem((PyObject *)obj->cred_info, i, (PyObject *)ci);1931 PyList_Append((PyObject *)obj->cred_info, (PyObject *)ci); 1927 1932 } 1928 1933 … … 1992 1997 return NULL; 1993 1998 } 1994 self->proxy = (PyListObject *)PyList_New( 8);1999 self->proxy = (PyListObject *)PyList_New(0); 1995 2000 if (self->proxy == NULL) { 1996 2001 Py_DECREF(self); 1997 2002 return NULL; 1998 2003 } 1999 self->cred_info = (PyListObject *)PyList_New( 8);2004 self->cred_info = (PyListObject *)PyList_New(0); 2000 2005 if (self->cred_info == NULL) { 2001 2006 Py_DECREF(self);
Note: See TracChangeset
for help on using the changeset viewer.