diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-06-12 00:04:32 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2014-06-12 00:04:32 +0000 |
commit | 1c3070b8dff74a448d9da68683320a144e73d7e9 (patch) | |
tree | 5a7b62f60b10de6a9d9f4f862fdb9f1f8f500f3d /flashrom.c | |
parent | 1b877cd791a1677cdc741cd7a724f1b635d3bbea (diff) | |
download | flashrom-1c3070b8dff74a448d9da68683320a144e73d7e9.zip flashrom-1c3070b8dff74a448d9da68683320a144e73d7e9.tar.gz |
Introduce helpers.c
Move some suitable functions there, add it to the Makefile, but leave the
declarations in flash.h for now.
Corresponding to flashrom svn r1819.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 36 |
1 files changed, 0 insertions, 36 deletions
@@ -535,42 +535,6 @@ int read_memmapped(struct flashctx *flash, uint8_t *buf, unsigned int start, return 0; } -int min(int a, int b) -{ - return (a < b) ? a : b; -} - -int max(int a, int b) -{ - return (a > b) ? a : b; -} - -int bitcount(unsigned long a) -{ - int i = 0; - for (; a != 0; a >>= 1) - if (a & 1) - i++; - return i; -} - -void tolower_string(char *str) -{ - for (; *str != '\0'; str++) - *str = (char)tolower((unsigned char)*str); -} - -char *strcat_realloc(char *dest, const char *src) -{ - dest = realloc(dest, strlen(dest) + strlen(src) + 1); - if (!dest) { - msg_gerr("Out of memory!\n"); - return NULL; - } - strcat(dest, src); - return dest; -} - /* This is a somewhat hacked function similar in some ways to strtok(). * It will look for needle with a subsequent '=' in haystack, return a copy of * needle and remove everything from the first occurrence of needle to the next |