Skip to content
Permalink
Browse files
[clean-up] Remove still some more unneeded casting
Hopefully the last bits of unneeded casting and faulty use of const
are now gone.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Nov 11, 2014
1 parent 1495f86 commit 81d0fe287ad2768fea636ff4c9e07bbd62952229
Showing with 34 additions and 34 deletions.
  1. +6 −6 src/usb_moded-android.c
  2. +9 −9 src/usb_moded-config.c
  3. +9 −9 src/usb_moded-config.h
  4. +6 −5 src/usb_moded-trigger.c
  5. +4 −5 src/usb_moded.c
@@ -47,37 +47,37 @@ int android_settings(void)
*/
void android_init_values(void)
{
const char *text;
char *text;

text = get_android_manufacturer();
if(text)
{
write_to_file("/sys/class/android_usb/android0/iManufacturer", text);
g_free((char *)text);
g_free(text);
}
text = get_android_vendor_id();
if(text)
{
write_to_file("/sys/class/android_usb/android0/idVendor", text);
g_free((char *)text);
g_free(text);
}
text = get_android_product();
if(text)
{
write_to_file("/sys/class/android_usb/android0/iProduct", text);
g_free((char *)text);
g_free(text);
}
text = get_android_product_id();
if(text)
{
write_to_file("/sys/class/android_usb/android0/idProduct", text);
g_free((char *)text);
g_free(text);
}
text = read_mac();
if(text)
{
write_to_file("/sys/class/android_usb/f_rndis/ethaddr", text);
g_free((char *)text);
g_free(text);
}
/* For rndis to be discovered correctly in M$ Windows (vista and later) */
write_to_file("/sys/class/android_usb/f_rndis/wceis", "1");
@@ -107,27 +107,27 @@ int find_cdrom_timeout(void)
}
#endif /* NOKIA */

const char * check_trigger(void)
char * check_trigger(void)
{
return(get_conf_string(TRIGGER_ENTRY, TRIGGER_PATH_KEY));
}

const char * get_trigger_subsystem(void)
char * get_trigger_subsystem(void)
{
return(get_conf_string(TRIGGER_ENTRY, TRIGGER_UDEV_SUBSYSTEM));
}

const char * get_trigger_mode(void)
char * get_trigger_mode(void)
{
return(get_conf_string(TRIGGER_ENTRY, TRIGGER_MODE_KEY));
}

const char * get_trigger_property(void)
char * get_trigger_property(void)
{
return(get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_KEY));
}

const char * get_trigger_value(void)
char * get_trigger_value(void)
{
return(get_conf_string(TRIGGER_ENTRY, TRIGGER_PROPERTY_VALUE_KEY));
}
@@ -572,22 +572,22 @@ int conf_file_merge(void)
return(ret);
}

const char * get_android_manufacturer(void)
char * get_android_manufacturer(void)
{
return(get_conf_string(ANDROID_ENTRY, ANDROID_MANUFACTURER_KEY));
}

const char * get_android_vendor_id(void)
char * get_android_vendor_id(void)
{
return(get_conf_string(ANDROID_ENTRY, ANDROID_VENDOR_ID_KEY));
}

const char * get_android_product(void)
char * get_android_product(void)
{
return(get_conf_string(ANDROID_ENTRY, ANDROID_PRODUCT_KEY));
}

const char * get_android_product_id(void)
char * get_android_product_id(void)
{
return(get_conf_string(ANDROID_ENTRY, ANDROID_PRODUCT_ID_KEY));
}
@@ -68,21 +68,21 @@ const char * find_cdrom_path(void);
int find_cdrom_timeout(void);
#endif

const char * check_trigger(void);
const char * get_trigger_subsystem(void);
const char * get_trigger_mode(void);
const char * get_trigger_property(void);
const char * get_trigger_value(void);
char * check_trigger(void);
char * get_trigger_subsystem(void);
char * get_trigger_mode(void);
char * get_trigger_property(void);
char * get_trigger_value(void);

char * get_network_ip(void);
char * get_network_interface(void);
char * get_network_gateway(void);
char * get_network_nat_interface(void);

const char * get_android_manufacturer(void);
const char * get_android_vendor_id(void);
const char * get_android_product(void);
const char * get_android_product_id(void);
char * get_android_manufacturer(void);
char * get_android_vendor_id(void);
char * get_android_product(void);
char * get_android_product_id(void);

int check_android_section(void);

@@ -172,19 +172,20 @@ void trigger_stop(void)

static void udev_parse(struct udev_device *dev)
{
const char *tmp, *trigger = 0;
const char *tmp = 0;
char *trigger = 0;

trigger = get_trigger_property();
tmp = udev_device_get_property_value(dev, trigger);
if(!tmp)
{
/* do nothing and return */
free((void *)trigger);
free(trigger);
return;
}
else
{
free((void *)trigger);
free(trigger);
trigger = get_trigger_value();
if(trigger)
{
@@ -198,11 +199,11 @@ static void udev_parse(struct udev_device *dev)
usb_moded_mode_cleanup(get_usb_module());
set_usb_mode(get_trigger_mode());
}
free((void *)trigger);
free(trigger);
}
else
{
free((void *)trigger);
free(trigger);
return;
}
}
@@ -210,8 +210,7 @@ void set_charger_connected(gboolean state)
*/
void set_usb_connected_state(void)
{

const char *mode_to_set;
char *mode_to_set;
#ifdef MEEGOLOCK
int export = 1; /* assume locked */
#endif /* MEEGOLOCK */
@@ -283,7 +282,7 @@ void set_usb_connected_state(void)
set_usb_mode(MODE_CHARGING_FALLBACK);
}
end:
free((void *)mode_to_set);
free(mode_to_set);
}

/** set the usb mode
@@ -626,8 +625,8 @@ static void handle_exit(void)
g_main_loop_quit(mainloop);
g_main_loop_unref(mainloop);
}
free((void *)current_mode.mode);
free((void *)current_mode.module);
free(current_mode.mode);
free(current_mode.module);

log_debug("All resources freed. Exiting!\n");

0 comments on commit 81d0fe2

Please sign in to comment.