summaryrefslogtreecommitdiff
path: root/gusb/gusb-source.c
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@src.gnome.org>2011-09-03 21:10:12 +0300
committerDebarshi Ray <debarshir@src.gnome.org>2011-09-08 03:21:35 +0300
commit4008d8c609ff0d4b015a44bd033dba5adf6cd527 (patch)
treef14bb742361a0fef985e878cc055f633b1d09332 /gusb/gusb-source.c
parentab2f4f84cb592c3be3ce0870b226b3031b848c29 (diff)
downloadgusb-4008d8c609ff0d4b015a44bd033dba5adf6cd527.tar.gz
g_usb_source_new won't return NULL
This is because libusb_get_pollfds won't return NULL unless OOM or on Windows, which is not supported at the moment.
Diffstat (limited to 'gusb/gusb-source.c')
-rw-r--r--gusb/gusb-source.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/gusb/gusb-source.c b/gusb/gusb-source.c
index e6c2801..ddb4635 100644
--- a/gusb/gusb-source.c
+++ b/gusb/gusb-source.c
@@ -228,14 +228,13 @@ static GSourceFuncs usb_source_funcs = {
*
* Creates a source for integration into libusb1.
*
- * Return value: (transfer none): the #GUsbSource, or %NULL. Use g_usb_source_destroy() to unref.
+ * Return value: (transfer none): the #GUsbSource. Use g_usb_source_destroy() to unref.
*
* Since: 0.1.0
**/
GUsbSource *
g_usb_source_new (GMainContext *main_ctx,
- GUsbContext *gusb_ctx,
- GError **error)
+ GUsbContext *gusb_ctx)
{
guint i;
const struct libusb_pollfd **pollfds;
@@ -249,15 +248,6 @@ g_usb_source_new (GMainContext *main_ctx,
/* watch the fd's already created */
pollfds = libusb_get_pollfds (gusb_source->ctx);
- if (pollfds == NULL) {
- g_set_error_literal (error,
- G_USB_SOURCE_ERROR,
- G_USB_SOURCE_ERROR_INTERNAL,
- "failed to allocate memory");
- g_free (gusb_source);
- gusb_source = NULL;
- goto out;
- }
for (i=0; pollfds[i] != NULL; i++)
g_usb_source_pollfd_add (gusb_source,
pollfds[i]->fd,
@@ -270,7 +260,7 @@ g_usb_source_new (GMainContext *main_ctx,
g_usb_source_pollfd_added_cb,
g_usb_source_pollfd_removed_cb,
gusb_source);
-out:
+
return gusb_source;
}