summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2015-06-05 16:47:22 +0200
committerGravatar Christian Hesse <mail@eworm.de>2015-06-05 16:47:22 +0200
commitf3e1004714beea34e77125cbee5c77bfaa377a32 (patch)
tree6f5b9e3b964affa3e5ca9778b64986f9764a129d
parent4068df2b833303079f78adad0de25cc00674fa27 (diff)
downloadudev-block-notify-f3e1004714beea34e77125cbee5c77bfaa377a32.tar.gz
udev-block-notify-f3e1004714beea34e77125cbee5c77bfaa377a32.tar.zst
fix const usage
-rw-r--r--udev-block-notify.c10
-rw-r--r--udev-block-notify.h4
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 ***/