Skip to contentSkip to conversation

libfdt: Make fdt_string() return a const pointer

PATCH Applied David Gibson 2 participants 4 messages Oct 18, 2007 – Oct 23, 2007

lore
Share & tools
lore
#0 lore raw

Currently, fdt_string() returns a (non-const) char *, despite taking a const void *fdt. This is inconsistent with all the other read-only functions which all return const pointers into the blob.

This patch fixes that.

libfdt/fdt_ro.c +1 -1
Index: dtc/libfdt/fdt_ro.c
===================================================================
@@ -82,7 +82,7 @@ static int nodename_eq(const void *fdt, 
 		return 0;
 }
 
-char *fdt_string(const void *fdt, int stroffset)
+const char *fdt_string(const void *fdt, int stroffset)
 {
 	return (char *)fdt + fdt_off_dt_strings(fdt) + stroffset;
 }
libfdt/libfdt.h +1 -1
Index: dtc/libfdt/libfdt.h
===================================================================
@@ -110,7 +110,7 @@ static inline void *fdt_offset_ptr_w(voi
 int fdt_move(const void *fdt, void *buf, int bufsize);
 
 /* Read-only functions */
-char *fdt_string(const void *fdt, int stroffset);
+const char *fdt_string(const void *fdt, int stroffset);
 
 int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
 int fdt_num_mem_rsv(const void *fdt);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#1 lore raw

So, like, the other day David Gibson mumbled:

Quoted 7 lines

Currently, fdt_string() returns a (non-const) char *, despite taking a const void *fdt. This is inconsistent with all the other read-only functions which all return const pointers into the blob.

This patch fixes that.

Applied.

jdl

#2 lore raw
Quoted 10 lines · Jon Loeliger

So, like, the other day David Gibson mumbled:

Quoted 7 lines

Currently, fdt_string() returns a (non-const) char *, despite taking a const void *fdt. This is inconsistent with all the other read-only functions which all return const pointers into the blob.

This patch fixes that.

Applied.

But apparently not pushed out to the public tree...

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw

So, like, the other day David Gibson mumbled:

Quoted 4 lines
Quoted 2 lines

Applied.

But apparently not pushed out to the public tree...

Oh, sorry. I got side-tracked...

Coming up...

jdl