Re: PATCH [2/5]: pyblock: Make first 2 args of pydm_map_init_method() mandatory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux