* [udev] small cleanup udev-remove.c
@ 2003-12-22 22:32 Kay Sievers
0 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2003-12-22 22:32 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 120 bytes --]
Here is a small cleanup. It replaces the malloc in udev-remove.c
with a struct, like we do in udev-add.c
thanks,
Kay
[-- Attachment #2: 01-struct-instead-of-malloc.diff --]
[-- Type: text/plain, Size: 1037 bytes --]
diff -Nru a/udev-remove.c b/udev-remove.c
--- a/udev-remove.c Mon Dec 22 21:56:33 2003
+++ b/udev-remove.c Mon Dec 22 21:56:33 2003
@@ -118,30 +118,26 @@
*/
int udev_remove_device(char *path, char *subsystem)
{
- struct udevice *dev;
+ struct udevice dev;
char *temp;
int retval;
- dev = malloc(sizeof(*dev));
- if (dev == NULL)
- return -ENOMEM;
- memset(dev, 0, sizeof(*dev));
+ memset(&dev, 0, sizeof(dev));
- retval = udevdb_get_dev(path, dev);
+ retval = udevdb_get_dev(path, &dev);
if (retval) {
dbg("'%s' not found in database, falling back on default name", path);
temp = strrchr(path, '/');
if (temp == NULL)
return -ENODEV;
- strncpy(dev->name, &temp[1], sizeof(dev->name));
+ strncpy(dev.name, &temp[1], sizeof(dev.name));
}
- dbg("name is '%s'", dev->name);
+ dbg("name is '%s'", dev.name);
udevdb_delete_dev(path);
- sysbus_send_remove(dev->name, path);
+ sysbus_send_remove(dev.name, path);
- retval = delete_node(dev);
- free(dev);
+ retval = delete_node(&dev);
return retval;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [udev] small cleanup udev-remove.c
@ 2003-12-22 22:57 Rob Love
2003-12-22 22:57 ` Greg KH
2003-12-22 23:23 ` Kay Sievers
0 siblings, 2 replies; 4+ messages in thread
From: Rob Love @ 2003-12-22 22:57 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2003-12-22 at 17:32, Kay Sievers wrote:
> Here is a small cleanup. It replaces the malloc in udev-remove.c
> with a struct, like we do in udev-add.c
Haha, Greg is such a kernel hacker.
malloc'ing a struct in user-space? ;-)
/me smiles
Rob Love
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [udev] small cleanup udev-remove.c
2003-12-22 22:57 Rob Love
@ 2003-12-22 22:57 ` Greg KH
2003-12-22 23:23 ` Kay Sievers
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2003-12-22 22:57 UTC (permalink / raw)
To: linux-hotplug
On Mon, Dec 22, 2003 at 11:32:11PM +0100, Kay Sievers wrote:
>
> Here is a small cleanup. It replaces the malloc in udev-remove.c
> with a struct, like we do in udev-add.c
Applied, thanks.
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [udev] small cleanup udev-remove.c
2003-12-22 22:57 Rob Love
2003-12-22 22:57 ` Greg KH
@ 2003-12-22 23:23 ` Kay Sievers
1 sibling, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2003-12-22 23:23 UTC (permalink / raw)
To: linux-hotplug
On Mon, Dec 22, 2003 at 05:57:21PM -0500, Rob Love wrote:
> On Mon, 2003-12-22 at 17:32, Kay Sievers wrote:
> > Here is a small cleanup. It replaces the malloc in udev-remove.c
> > with a struct, like we do in udev-add.c
>
> Haha, Greg is such a kernel hacker.
>
> malloc'ing a struct in user-space? ;-)
Oh, but it was me.
I've moved it from the db-code, where the malloc was perfectly ok :)
Kay
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-12-22 23:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-22 22:32 [udev] small cleanup udev-remove.c Kay Sievers
-- strict thread matches above, loose matches on Subject: below --
2003-12-22 22:57 Rob Love
2003-12-22 22:57 ` Greg KH
2003-12-22 23:23 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).