diff options
author | pauln <devnull@localhost> | 2004-03-11 08:32:02 +0000 |
---|---|---|
committer | pauln <devnull@localhost> | 2004-03-11 08:32:02 +0000 |
commit | 5f12397f520f3a879ed82e73046cad62b9bec633 (patch) | |
tree | 513a33ff0a1b4bbfd0ee08915e632d2ff5f7d669 | |
parent | da9a1be04c4225fd6855c900ff3c011ac2347b50 (diff) | |
download | librpm-tizen-5f12397f520f3a879ed82e73046cad62b9bec633.tar.gz librpm-tizen-5f12397f520f3a879ed82e73046cad62b9bec633.tar.bz2 librpm-tizen-5f12397f520f3a879ed82e73046cad62b9bec633.zip |
Make spec-py lint free.
CVS patchset: 7166
CVS date: 2004/03/11 08:32:02
-rw-r--r-- | python/spec-py.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/python/spec-py.c b/python/spec-py.c index e7d9639e1..1170fc373 100644 --- a/python/spec-py.c +++ b/python/spec-py.c @@ -49,12 +49,15 @@ spec_print(specObject * s) return 0; } +/* XXX TODO return something sensible if spec exists but component (eg %clean) + * does not. Possibly "" or None */ + static PyObject * spec_get_buildroot(specObject * s) /*@*/ { Spec spec = specFromSpec(s); - if (spec->buildRootURL) { + if (spec != NULL && spec->buildRootURL) { return Py_BuildValue("s", spec->buildRootURL); } else { @@ -67,14 +70,14 @@ spec_get_prep(specObject * s) /*@*/ { Spec spec = specFromSpec(s); - if (spec->prep) { + if (spec != NULL && spec->prep) { StringBuf sb = newStringBuf(); sb=spec->prep; return Py_BuildValue("s",getStringBuf(sb)); } - else { - return NULL; - } + else { + return NULL; + } } static PyObject * @@ -82,14 +85,14 @@ spec_get_build(specObject * s) /*@*/ { Spec spec = specFromSpec(s); - if (spec->build) { + if (spec != NULL && spec->build) { StringBuf sb = newStringBuf(); sb=spec->build; return Py_BuildValue("s",getStringBuf(sb)); } - else { - return NULL; - } + else { + return NULL; + } } static PyObject * @@ -97,14 +100,14 @@ spec_get_install(specObject * s) /*@*/ { Spec spec = specFromSpec(s); - if (spec->install) { + if (spec != NULL && spec->install) { StringBuf sb = newStringBuf(); sb=spec->install; return Py_BuildValue("s",getStringBuf(sb)); } - else { - return NULL; - } + else { + return NULL; + } } static PyObject * @@ -112,14 +115,14 @@ spec_get_clean(specObject * s) /*@*/ { Spec spec = specFromSpec(s); - if (spec->clean) { + if (spec != NULL && spec->clean) { StringBuf sb = newStringBuf(); sb=spec->clean; return Py_BuildValue("s",getStringBuf(sb)); } - else { - return NULL; - } + else { + return NULL; + } } static PyObject * @@ -129,18 +132,25 @@ spec_get_sources(specObject *s) struct Source * source; PyObject *sourceList, *srcUrl; Spec spec; + char * fullSource; sourceList = PyList_New(0); spec = specFromSpec(s); - source = spec->sources; + if ( spec != NULL) { + source = spec->sources; - while (source != NULL) { - srcUrl = Py_BuildValue("(sii)", source->fullSource, source->num, source->flags); - PyList_Append(sourceList, srcUrl); - source=source->next; - } + while (source != NULL) { + fullSource = source->fullSource; + srcUrl = Py_BuildValue("(sii)", fullSource, source->num, source->flags); + PyList_Append(sourceList, srcUrl); + source=source->next; + } - return PyList_AsTuple(sourceList); + return PyList_AsTuple(sourceList); + } + else { + return NULL; + } } |