Skip to content
Permalink
Browse files
[clean-up] Remove more const stuff
Avoid unneeded casting.

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Nov 7, 2014
1 parent c2fe327 commit 0cb508b2b296bf84f58558b78f971dd6d6564610
Showing with 20 additions and 20 deletions.
  1. +2 −2 src/usb_moded-config-private.h
  2. +12 −12 src/usb_moded-config.c
  3. +2 −2 src/usb_moded-config.h
  4. +3 −3 src/usb_moded-dbus.c
  5. +1 −1 src/usb_moded-udev.c
@@ -23,7 +23,7 @@

/*============================================================================= */

const char * get_mode_setting(void);
char * get_mode_setting(void);
int set_mode_setting(const char *mode);
int set_network_setting(const char *config, const char *setting);
const char *get_network_setting(const char *config);
char *get_network_setting(const char *config);
@@ -85,12 +85,12 @@ const char * find_alt_mount(void)
return(get_conf_string(ALT_MOUNT_ENTRY, ALT_MOUNT_KEY));
}

const char * find_udev_path(void)
char * find_udev_path(void)
{
return(get_conf_string(UDEV_PATH_ENTRY, UDEV_PATH_KEY));
}

const char * find_udev_subsystem(void)
char * find_udev_subsystem(void)
{
return(get_conf_string(UDEV_PATH_ENTRY, UDEV_SUBSYSTEM_KEY));
}
@@ -333,9 +333,9 @@ static char * get_kcmdline_string(const char *entry)
return(ret);
}

const char * get_mode_setting(void)
char * get_mode_setting(void)
{
const char * mode = get_kcmdline_string(MODE_SETTING_KEY);
char * mode = get_kcmdline_string(MODE_SETTING_KEY);
if (mode != NULL)
return(mode);

@@ -418,9 +418,9 @@ int set_network_setting(const char *config, const char *setting)
return(!ret);
}

const char * get_network_setting(const char *config)
char * get_network_setting(const char *config)
{
const char * ret = 0;
char * ret = 0;
struct mode_list_elem *data;

if(!strcmp(config, NETWORK_IP_KEY))
@@ -457,12 +457,12 @@ int conf_file_merge(void)
{
GDir *confdir;
struct stat fileinfo, dir;
const gchar *filename, *mode = 0, *ip = 0, *gateway = 0;
char *mode = 0, *ip = 0, *gateway = 0, *udev = 0;
gchar *filename_full;
const gchar *filename;
GString *keyfile_string = NULL;
GKeyFile *settingsfile;
int ret = 0, test = 0, conffile_created = 0;
const gchar *udev = 0;

confdir = g_dir_open(CONFIG_FILE_DIR, 0, NULL);
if(!confdir)
@@ -559,13 +559,13 @@ int conf_file_merge(void)
ret = 1;
cleanup:
if(mode)
free((void *)mode);
free(mode);
if(udev)
free((void *)udev);
free(udev);
if(ip)
free((void *)ip);
free(ip);
if(gateway)
free((void *)gateway);
free(gateway);

end:
g_dir_close(confdir);
@@ -60,8 +60,8 @@ const char * find_mounts(void);
int find_sync(void);
const char * find_alt_mount(void);

const char * find_udev_path(void);
const char * find_udev_subsystem(void);
char * find_udev_path(void);
char * find_udev_subsystem(void);

#ifdef NOKIA
const char * find_cdrom_path(void);
@@ -155,7 +155,7 @@ static DBusHandlerResult msg_handler(DBusConnection *const connection, DBusMessa
else if(!strcmp(member, USB_MODE_NETWORK_GET))
{
char *config = 0;
const char *setting = 0;
char *setting = 0;
DBusError err = DBUS_ERROR_INIT;

if(!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &config, DBUS_TYPE_INVALID))
@@ -177,11 +177,11 @@ static DBusHandlerResult msg_handler(DBusConnection *const connection, DBusMessa
}
else if(!strcmp(member, USB_MODE_CONFIG_GET))
{
const char *config = get_mode_setting();
char *config = get_mode_setting();

if((reply = dbus_message_new_method_return(msg)))
dbus_message_append_args (reply, DBUS_TYPE_STRING, &config, DBUS_TYPE_INVALID);
free((void *)config);
free(config);
}
else if(!strcmp(member, USB_MODE_LIST))
{
@@ -63,7 +63,7 @@ static void notify_issue (gpointer data)

gboolean hwal_init(void)
{
const gchar *udev_path = NULL, *udev_subsystem = NULL;
char *udev_path = NULL, *udev_subsystem = NULL;
struct udev_device *dev;
int ret = 0;

0 comments on commit 0cb508b

Please sign in to comment.