diff options
| author | Khem Raj <khem.raj@oss.qualcomm.com> | 2026-04-11 00:25:55 -0700 |
|---|---|---|
| committer | Khem Raj <khem.raj@oss.qualcomm.com> | 2026-04-11 08:44:33 -0700 |
| commit | 476b8eb5eb55c49c4300bcef86ee0092cb884ec7 (patch) | |
| tree | f32ebc8feca30a6294245c88e2fb4dfa75414ddf | |
| parent | f76f6ebdd169f0a1f84fd0aab49fc803aa5c4fd4 (diff) | |
| download | meta-openembedded-476b8eb5eb55c49c4300bcef86ee0092cb884ec7.tar.gz | |
log4c: convert K&R function declarations to ANSI C prototypes
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
| -rw-r--r-- | meta-oe/recipes-support/log4c/log4c/0001-sd-malloc-convert-K-R-function-declarations-to-ANSI-.patch | 92 | ||||
| -rw-r--r-- | meta-oe/recipes-support/log4c/log4c_1.2.4.bb | 1 |
2 files changed, 93 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/log4c/log4c/0001-sd-malloc-convert-K-R-function-declarations-to-ANSI-.patch b/meta-oe/recipes-support/log4c/log4c/0001-sd-malloc-convert-K-R-function-declarations-to-ANSI-.patch new file mode 100644 index 0000000000..fae1a2d0c2 --- /dev/null +++ b/meta-oe/recipes-support/log4c/log4c/0001-sd-malloc-convert-K-R-function-declarations-to-ANSI-.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From b0ecadec662a8e35b017e16e92c5b1a04ed72598 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <khem.raj@oss.qualcomm.com> | ||
| 3 | Date: Sat, 11 Apr 2026 00:24:17 -0700 | ||
| 4 | Subject: [PATCH] sd/malloc: convert K&R function declarations to ANSI C | ||
| 5 | prototypes | ||
| 6 | |||
| 7 | Replace old-style K&R parameter declarations with modern ANSI C | ||
| 8 | (C89/C90) function prototypes across all functions in malloc.c. | ||
| 9 | Also remove trailing whitespace in fixup_null_alloc(). | ||
| 10 | |||
| 11 | Upstream-Status: Pending | ||
| 12 | Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com> | ||
| 13 | --- | ||
| 14 | src/sd/malloc.c | 23 ++++++++--------------- | ||
| 15 | 1 file changed, 8 insertions(+), 15 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/src/sd/malloc.c b/src/sd/malloc.c | ||
| 18 | index 7d241ad..43dd460 100644 | ||
| 19 | --- a/src/sd/malloc.c | ||
| 20 | +++ b/src/sd/malloc.c | ||
| 21 | @@ -41,8 +41,7 @@ typedef void (*sd_malloc_handler_t)(); | ||
| 22 | static sd_malloc_handler_t handler = NULL; | ||
| 23 | |||
| 24 | static void * | ||
| 25 | -fixup_null_alloc (n) | ||
| 26 | - size_t n; | ||
| 27 | +fixup_null_alloc (size_t n) | ||
| 28 | { | ||
| 29 | void* p = 0; | ||
| 30 | |||
| 31 | @@ -62,8 +61,8 @@ fixup_null_alloc (n) | ||
| 32 | allocated = (char *) sbrk (0) - (char *) &environ; | ||
| 33 | sd_error("\nCannot allocate %lu bytes after allocating %lu bytes\n", | ||
| 34 | (unsigned long) n, (unsigned long) allocated); | ||
| 35 | - | ||
| 36 | - if (handler) | ||
| 37 | + | ||
| 38 | + if (handler) | ||
| 39 | handler(); | ||
| 40 | else { | ||
| 41 | sd_error("\n\tMemory exhausted !! Aborting.\n"); | ||
| 42 | @@ -75,8 +74,7 @@ fixup_null_alloc (n) | ||
| 43 | } | ||
| 44 | |||
| 45 | sd_malloc_handler_t | ||
| 46 | -sd_malloc_set_handler(a_handler) | ||
| 47 | - sd_malloc_handler_t a_handler; | ||
| 48 | +sd_malloc_set_handler(sd_malloc_handler_t a_handler) | ||
| 49 | { | ||
| 50 | sd_malloc_handler_t previous = handler; | ||
| 51 | |||
| 52 | @@ -87,8 +85,7 @@ sd_malloc_set_handler(a_handler) | ||
| 53 | /* Allocate N bytes of memory dynamically, with error checking. */ | ||
| 54 | |||
| 55 | void * | ||
| 56 | -sd_malloc (n) | ||
| 57 | - size_t n; | ||
| 58 | +sd_malloc (size_t n) | ||
| 59 | { | ||
| 60 | void *p; | ||
| 61 | |||
| 62 | @@ -101,8 +98,7 @@ sd_malloc (n) | ||
| 63 | /* Allocate memory for N elements of S bytes, with error checking. */ | ||
| 64 | |||
| 65 | void * | ||
| 66 | -sd_calloc (n, s) | ||
| 67 | - size_t n, s; | ||
| 68 | +sd_calloc (size_t n, size_t s) | ||
| 69 | { | ||
| 70 | void *p; | ||
| 71 | |||
| 72 | @@ -117,9 +113,7 @@ sd_calloc (n, s) | ||
| 73 | If P is NULL, run sd_malloc. */ | ||
| 74 | |||
| 75 | void * | ||
| 76 | -sd_realloc (p, n) | ||
| 77 | - void *p; | ||
| 78 | - size_t n; | ||
| 79 | +sd_realloc (void *p, size_t n) | ||
| 80 | { | ||
| 81 | if (p == 0) | ||
| 82 | return sd_malloc (n); | ||
| 83 | @@ -132,8 +126,7 @@ sd_realloc (p, n) | ||
| 84 | /* Return a newly allocated copy of STRING. */ | ||
| 85 | |||
| 86 | char * | ||
| 87 | -sd_strdup (string) | ||
| 88 | - const char *string; | ||
| 89 | +sd_strdup (const char *string) | ||
| 90 | { | ||
| 91 | return strcpy (sd_malloc (strlen (string) + 1), string); | ||
| 92 | } | ||
diff --git a/meta-oe/recipes-support/log4c/log4c_1.2.4.bb b/meta-oe/recipes-support/log4c/log4c_1.2.4.bb index a0bd40b03a..eca800dc5e 100644 --- a/meta-oe/recipes-support/log4c/log4c_1.2.4.bb +++ b/meta-oe/recipes-support/log4c/log4c_1.2.4.bb | |||
| @@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" | |||
| 6 | SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.gz \ | 6 | SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.gz \ |
| 7 | file://fix_configure_with-expat.patch \ | 7 | file://fix_configure_with-expat.patch \ |
| 8 | file://0001-Use-the-API-properly-in-the-example-format-security-.patch \ | 8 | file://0001-Use-the-API-properly-in-the-example-format-security-.patch \ |
| 9 | file://0001-sd-malloc-convert-K-R-function-declarations-to-ANSI-.patch \ | ||
| 9 | " | 10 | " |
| 10 | 11 | ||
| 11 | SRC_URI[sha256sum] = "5991020192f52cc40fa852fbf6bbf5bd5db5d5d00aa9905c67f6f0eadeed48ea" | 12 | SRC_URI[sha256sum] = "5991020192f52cc40fa852fbf6bbf5bd5db5d5d00aa9905c67f6f0eadeed48ea" |
