Make thirty functions static to reduce binary size
If any of those functions should be (unused) API functions,
they can easily be turned back once really needed.
Detected using a new cppcheck check that
uses the internal symbol database to catch
functions that are only used in the current file.
Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
diff --git a/apps/plugins/pdbox/PDa/src/d_imayer_fft.c b/apps/plugins/pdbox/PDa/src/d_imayer_fft.c
index a78b937..f0d3f34 100644
--- a/apps/plugins/pdbox/PDa/src/d_imayer_fft.c
+++ b/apps/plugins/pdbox/PDa/src/d_imayer_fft.c
@@ -110,7 +110,7 @@
#define SQRT2 ftofix(1.414213562373095048801688724209698)
-void imayer_fht(t_fixed *fz, int n)
+static void imayer_fht(t_fixed *fz, int n)
{
int k,k1,k2,k3,k4,kx;
t_fixed *fi,*fn,*gi;
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
index de2988b..96ea1cf 100644
--- a/firmware/drivers/ata_flash.c
+++ b/firmware/drivers/ata_flash.c
@@ -73,7 +73,7 @@
static struct flash_disk flash_disk;
-void flash_select_chip(int no, int sel)
+static void flash_select_chip(int no, int sel)
{
#if CONFIG_FLASH == FLASH_IFP7XX
if (sel)
@@ -115,7 +115,7 @@
static unsigned char model_n_sectors_order[] = {0, 19, 20};
-int flash_map_sector(int sector, int* chip, int* chip_sector)
+static int flash_map_sector(int sector, int* chip, int* chip_sector)
{
int ord, c;
if (flash_disk.model == FLASH_MODEL_NONE)
@@ -132,7 +132,7 @@
return 0;
}
-int flash_read_id(int no) {
+static int flash_read_id(int no) {
int id;
flash_select_chip(no, 1);
@@ -146,7 +146,7 @@
return id;
}
-int flash_read_sector(int sector, unsigned char* buf,
+static int flash_read_sector(int sector, unsigned char* buf,
unsigned char* oob)
{
unsigned long *bufl = (unsigned long *)buf;
@@ -204,7 +204,7 @@
return 0;
}
-int flash_read_sector_oob(int sector, unsigned char* oob)
+static int flash_read_sector_oob(int sector, unsigned char* oob)
{
int chip, chip_sector;
int i;
@@ -294,7 +294,7 @@
return -1;
}
-int flash_disk_scan(void)
+static int flash_disk_scan(void)
{
int n_segments, n_phblocks;
unsigned char oob[16];
@@ -327,7 +327,7 @@
return 0;
}
-int flash_disk_find_block(int block)
+static int flash_disk_find_block(int block)
{
int seg, bmod, phb;
unsigned char oob[16];
@@ -356,7 +356,7 @@
return flash_disk.cur_phblock_start;
}
-int flash_disk_read_sectors(unsigned long start,
+static int flash_disk_read_sectors(unsigned long start,
int count,
void* buf)
{
diff --git a/firmware/events.c b/firmware/events.c
index 3386c02..8015442 100644
--- a/firmware/events.c
+++ b/firmware/events.c
@@ -81,7 +81,7 @@
return do_add_event(id, oneshot, true, handler, user_data);
}
-void do_remove_event(unsigned short id, bool user_data_valid,
+static void do_remove_event(unsigned short id, bool user_data_valid,
void *handler, void *user_data)
{
int i;
diff --git a/firmware/ifp_usb_serial.c b/firmware/ifp_usb_serial.c
index 5392de0..f7e3a51 100644
--- a/firmware/ifp_usb_serial.c
+++ b/firmware/ifp_usb_serial.c
@@ -250,7 +250,7 @@
ISP1582_EPINDEX = 0x20;
}
-void usb_setup_endpoint(int idx, int max_pkt_size, int type)
+static void usb_setup_endpoint(int idx, int max_pkt_size, int type)
{
struct usb_endpoint *ep;
@@ -271,7 +271,7 @@
ep->max_pkt_size[epidx_dir(idx)] = max_pkt_size;
}
-void usb_disable_endpoint(int idx)
+static void usb_disable_endpoint(int idx)
{
usb_select_endpoint(idx);
ISP1582_EPTYPE &= 8;
@@ -288,12 +288,12 @@
ISP1582_MODE |= 1; /* SOFTCT on */
}
-void usb_cleanup(void)
+static void usb_cleanup(void)
{
ISP1582_MODE &= ~1; /* SOFTCT off */
}
-void usb_setup(int reset)
+static void usb_setup(int reset)
{
int i;
@@ -840,7 +840,7 @@
}
-void usb_handle_interrupts(void)
+static void usb_handle_interrupts(void)
{
#ifdef LCD_DEBUG
char s[20];
@@ -1002,7 +1002,7 @@
serial_restart_output(ep);
}
-void usb_serial_handle(void)
+static void usb_serial_handle(void)
{
#ifdef BUTTONS
static int t = 0;
diff --git a/flash/make_firmware/make_firmware.c b/flash/make_firmware/make_firmware.c
index a79f2b9..bd838bf 100644
--- a/flash/make_firmware/make_firmware.c
+++ b/flash/make_firmware/make_firmware.c
@@ -69,7 +69,7 @@
}
-UINT32 CalcCRC32 (const UINT8* buf, UINT32 len)
+static UINT32 CalcCRC32 (const UINT8* buf, UINT32 len)
{
static const UINT32 crc_table[256] =
{ // CRC32 lookup table for polynomial 0x04C11DB7
@@ -127,7 +127,7 @@
}
-UINT32 PlaceImage(char* filename, UINT32 pos, UINT8* pFirmware, UINT32 limit)
+static UINT32 PlaceImage(char* filename, UINT32 pos, UINT8* pFirmware, UINT32 limit)
{
UINT32 size, read;
FILE* pFile;
diff --git a/flash/minimon/minimon.c b/flash/minimon/minimon.c
index f34e94a..aca9cb5 100644
--- a/flash/minimon/minimon.c
+++ b/flash/minimon/minimon.c
@@ -21,7 +21,7 @@
tpMain start_vector[] __attribute__ ((section (".startvector"))) = {main};
-UINT8 uart_read(void)
+static UINT8 uart_read(void)
{
UINT8 byte;
while (!(SSR1 & SCI_RDRF)); // wait for char to be available
@@ -31,7 +31,7 @@
}
-void uart_write(UINT8 byte)
+static void uart_write(UINT8 byte)
{
while (!(SSR1 & SCI_TDRE)); // wait for transmit buffer empty
TDR1 = byte;
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index a26e6ce..b5ad023 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -1142,7 +1142,7 @@
}
/* Memory management */
-struct skin_element* skin_alloc_element()
+static struct skin_element* skin_alloc_element()
{
struct skin_element* retval = (struct skin_element*)
skin_buffer_alloc(sizeof(struct skin_element));
@@ -1164,7 +1164,7 @@
* enough for any tag. params should be used straight away by the callback
* so this is safe.
*/
-struct skin_tag_parameter* skin_alloc_params(int count)
+static struct skin_tag_parameter* skin_alloc_params(int count)
{
size_t size = sizeof(struct skin_tag_parameter) * count;
return (struct skin_tag_parameter*)skin_buffer_alloc(size);
@@ -1176,7 +1176,7 @@
return (char*)skin_buffer_alloc(sizeof(char) * (length + 1));
}
-OFFSETTYPE(struct skin_element*)* skin_alloc_children(int count)
+static OFFSETTYPE(struct skin_element*)* skin_alloc_children(int count)
{
return (OFFSETTYPE(struct skin_element*)*)
skin_buffer_alloc(sizeof(struct skin_element*) * count);
diff --git a/lib/skin_parser/skin_parser.h b/lib/skin_parser/skin_parser.h
index c53896c..c590725 100644
--- a/lib/skin_parser/skin_parser.h
+++ b/lib/skin_parser/skin_parser.h
@@ -160,9 +160,9 @@
struct skin_element* skin_parse(const char* document);
#endif
/* Memory management functions */
-struct skin_element* skin_alloc_element(void);
-OFFSETTYPE(struct skin_element*)* skin_alloc_children(int count);
-struct skin_tag_parameter* skin_alloc_params(int count);
+static struct skin_element* skin_alloc_element(void);
+static OFFSETTYPE(struct skin_element*)* skin_alloc_children(int count);
+static struct skin_tag_parameter* skin_alloc_params(int count);
char* skin_alloc_string(int length);
void skin_free_tree(struct skin_element* root);
diff --git a/lib/skin_parser/skin_scan.c b/lib/skin_parser/skin_scan.c
index f93606d..c5ce595 100644
--- a/lib/skin_parser/skin_scan.c
+++ b/lib/skin_parser/skin_scan.c
@@ -89,7 +89,7 @@
skip_enumlist(document);
}
-void skip_arglist(const char** document)
+static void skip_arglist(const char** document)
{
if(**document == ARGLISTOPENSYM)
(*document)++;
@@ -106,7 +106,7 @@
(*document)++;
}
-void skip_enumlist(const char** document)
+static void skip_enumlist(const char** document)
{
if(**document == ENUMLISTOPENSYM)
(*document)++;
diff --git a/lib/skin_parser/skin_scan.h b/lib/skin_parser/skin_scan.h
index 6281582..b1f842b 100644
--- a/lib/skin_parser/skin_scan.h
+++ b/lib/skin_parser/skin_scan.h
@@ -31,8 +31,8 @@
/* Scanning functions */
void skip_tag(const char** document);
void skip_comment(const char** document);
-void skip_arglist(const char** document);
-void skip_enumlist(const char** document);
+static void skip_arglist(const char** document);
+static void skip_enumlist(const char** document);
char* scan_string(const char** document);
int scan_int(const char** document);
int check_viewport(const char* document); /* Checks for a viewport declaration */