[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: PATCH [2/5]: pyblock: Make first 2 args of pydm_map_init_method() mandatory
- From: Joel Granados <jgranado redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: PATCH [2/5]: pyblock: Make first 2 args of pydm_map_init_method() mandatory
- Date: Wed, 25 Feb 2009 21:40:04 +0100
looks alright.
On Wed, Feb 25, 2009 at 08:16:07PM +0100, Hans de Goede wrote:
> pydm_map_create() must have a valid name and table as arguments, so make the
> first 2 arguments to pydm_map_init_method() mandatory.
> ---
> dm.c | 17 +++--------------
> 1 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/dm.c b/dm.c
> index 517e2fd..cd5110b 100644
> --- a/dm.c
> +++ b/dm.c
> @@ -877,11 +877,6 @@ pydm_map_create(PydmMapObject *map, PyObject *table)
> struct dm_task *task;
> int i;
>
> - if (!map->name) {
> - PyErr_SetString(PyExc_ValueError,
> - "name not set when creating map");
> - return -1;
> - }
> task = dm_task_create(DM_DEVICE_CREATE);
> if (!task) {
> if (!PyErr_Occurred()) {
> @@ -948,23 +943,17 @@ pydm_map_init_method(PyObject *self, PyObject
> *args, PyObject *kwds)
>
> pydm_map_clear(map);
>
> - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|zO!zO!:map.__init__",
> + if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO!|zO!:map.__init__",
> kwlist, &name, &PyList_Type, &table, &uuid,
> &PydmDevice_Type, &dev))
> return -1;
>
> - if (table && !name) {
> - PyErr_SetString(PyExc_RuntimeError,
> - "Cannot create device map without a name\n");
> - return -1;
> - }
> -
> Py_XINCREF(dev);
>
> + map->name = strdup(name);
> +
> if (uuid)
> map->uuid = strdup(uuid);
> - if (name)
> - map->name = strdup(name);
> if (dev)
> map->dev = (PyObject *)dev;
>
> --
> 1.6.1.3
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
--
Joel Andres Granados
Brno, Czech Republic, Red Hat.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]