From f3e1004714beea34e77125cbee5c77bfaa377a32 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 5 Jun 2015 16:47:22 +0200 Subject: fix const usage --- udev-block-notify.c | 10 +++++----- udev-block-notify.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/udev-block-notify.c b/udev-block-notify.c index 10ec41b..7738db9 100644 --- a/udev-block-notify.c +++ b/udev-block-notify.c @@ -48,7 +48,7 @@ NotifyNotification * get_notification(struct notifications *notifications, dev_t } /*** newstr ***/ -char * newstr(const char *text, char *device, unsigned short int major, unsigned short int minor) { +char * newstr(const char *text, const char *device, unsigned short int major, unsigned short int minor) { char *notifystr; notifystr = malloc(strlen(text) + strlen(device) + 10 /* max string length 2* unsigned short int */); @@ -58,7 +58,7 @@ char * newstr(const char *text, char *device, unsigned short int major, unsigned } /*** appendstr ***/ -char * appendstr(const char *text, char *notifystr, char *property, const char *value) { +char * appendstr(const char *text, char *notifystr, const char *property, const char *value) { notifystr = realloc(notifystr, strlen(text) + strlen(notifystr) + strlen(property) + strlen(value)); sprintf(notifystr + strlen(notifystr), text, property, value); @@ -68,8 +68,8 @@ char * appendstr(const char *text, char *notifystr, char *property, const char * /*** main ***/ int main (int argc, char ** argv) { const char *action = NULL; - char *device = NULL, *icon = NULL, *notifystr = NULL; - const char *value = NULL; + const char *device = NULL, *value = NULL; + char *icon = NULL, *notifystr = NULL; fd_set readfds; GError *error = NULL; NotifyNotification *notification = NULL; @@ -125,7 +125,7 @@ int main (int argc, char ** argv) { if ((mon != NULL) && FD_ISSET(udev_monitor_get_fd(mon), &readfds)) { dev = udev_monitor_receive_device(mon); if(dev) { - device = (char *) udev_device_get_sysname(dev); + device = udev_device_get_sysname(dev); /* ignore temporary device mapper devices * is there a better way to do this? */ diff --git a/udev-block-notify.h b/udev-block-notify.h index a0b0998..67154d5 100644 --- a/udev-block-notify.h +++ b/udev-block-notify.h @@ -33,11 +33,11 @@ NotifyNotification * get_notification(struct notifications *notifications, dev_t devnum); /*** newstr ***/ -char * newstr(const char *text, char *device, unsigned short int major, +char * newstr(const char *text, const char *device, unsigned short int major, unsigned short int minor); /*** appendstr ***/ -char * appendstr(const char *text, char *notifystr, char *property, +char * appendstr(const char *text, char *notifystr, const char *property, const char *value); /*** main ***/ -- cgit v1.2.3-54-g00ecf