From: Cristina Opriceana <cristina.opriceana@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH] Staging: iio: Replace const char * with const char []
Date: Mon, 16 Mar 2015 02:07:36 +0200 [thread overview]
Message-ID: <20150316000736.GA30387@Inspiron> (raw)
Replace const char * with const char [] as the first one is represented
in memory as a pointer which points to a string and the second one only
as a single variable in which it copies the contents.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
---
This can be tested by generating assembly code for the two cases;
This platform also offers a simple view: http://assembly.ynh.io/.
drivers/staging/iio/Documentation/iio_utils.h | 2 +-
drivers/staging/iio/Documentation/lsiio.c | 4 ++--
drivers/staging/iio/iio_dummy_evgen.c | 2 +-
drivers/staging/iio/iio_simple_dummy.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index bd6982c..aa9570a 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -23,7 +23,7 @@
#define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements"
#define FORMAT_TYPE_FILE "%s_type"
-const char *iio_dir = "/sys/bus/iio/devices/";
+const char iio_dir[] = "/sys/bus/iio/devices/";
/**
* iioutils_break_up_name() - extract generic name from full channel name
diff --git a/drivers/staging/iio/Documentation/lsiio.c b/drivers/staging/iio/Documentation/lsiio.c
index 98a0de0..50b0c70 100644
--- a/drivers/staging/iio/Documentation/lsiio.c
+++ b/drivers/staging/iio/Documentation/lsiio.c
@@ -26,8 +26,8 @@ static enum verbosity {
VERBLEVEL_SENSORS, /* 1 lists sensors */
} verblevel = VERBLEVEL_DEFAULT;
-const char *type_device = "iio:device";
-const char *type_trigger = "trigger";
+const char type_device[] = "iio:device";
+const char type_trigger[] = "trigger";
static inline int check_prefix(const char *str, const char *prefix)
diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c
index 59ad5a3..866e366 100644
--- a/drivers/staging/iio/iio_dummy_evgen.c
+++ b/drivers/staging/iio/iio_dummy_evgen.c
@@ -47,7 +47,7 @@ struct iio_dummy_eventgen {
/* We can only ever have one instance of this 'device' */
static struct iio_dummy_eventgen *iio_evgen;
-static const char *iio_evgen_name = "iio_dummy_evgen";
+static const char iio_evgen_name[] = "iio_dummy_evgen";
static void iio_dummy_event_irqmask(struct irq_data *d)
{
diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c
index 8341dce..4fe1073 100644
--- a/drivers/staging/iio/iio_simple_dummy.c
+++ b/drivers/staging/iio/iio_simple_dummy.c
@@ -36,7 +36,7 @@ module_param(instances, int, 0);
static struct iio_dev **iio_dummy_devs;
/* Fake a name for the part number, usually obtained from the id table */
-static const char *iio_dummy_part_number = "iio_dummy_part_no";
+static const char iio_dummy_part_number[] = "iio_dummy_part_no";
/**
* struct iio_dummy_accel_calibscale - realworld to register mapping
--
1.9.1
next reply other threads:[~2015-03-16 0:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 0:07 Cristina Opriceana [this message]
2015-03-16 9:11 ` [Outreachy kernel] [PATCH] Staging: iio: Replace const char * with const char [] Daniel Baluta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150316000736.GA30387@Inspiron \
--to=cristina.opriceana@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.