util/cbfstool: Include commonlib/helpers.h in common.h
This avoids re-declaring common macros like ARRAY_SIZE, MIN, MAX and ALIGN. Also removes the issues around including both files in any tool. Also, fix comparison error in various files by replacing int with size_t. Change-Id: I06c763e5dd1bec97e8335499468bbdb016eb28e5 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/14978 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
559e947306
commit
161d2334e8
|
@ -1251,7 +1251,7 @@ int cbfs_print_directory(struct cbfs_image *image)
|
||||||
|
|
||||||
int cbfs_print_parseable_directory(struct cbfs_image *image)
|
int cbfs_print_parseable_directory(struct cbfs_image *image)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
const char *header[] = {
|
const char *header[] = {
|
||||||
"Name",
|
"Name",
|
||||||
"Offset",
|
"Offset",
|
||||||
|
|
|
@ -139,7 +139,7 @@ static struct {
|
||||||
|
|
||||||
uint32_t string_to_arch(const char *arch_string)
|
uint32_t string_to_arch(const char *arch_string)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
uint32_t ret = CBFS_ARCHITECTURE_UNKNOWN;
|
uint32_t ret = CBFS_ARCHITECTURE_UNKNOWN;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(arch_names); i++) {
|
for (i = 0; i < ARRAY_SIZE(arch_names); i++) {
|
||||||
|
@ -154,7 +154,7 @@ uint32_t string_to_arch(const char *arch_string)
|
||||||
|
|
||||||
const char *arch_to_string(uint32_t a)
|
const char *arch_to_string(uint32_t a)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
const char *ret = NULL;
|
const char *ret = NULL;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(arch_names); i++) {
|
for (i = 0; i < ARRAY_SIZE(arch_names); i++) {
|
||||||
|
|
|
@ -22,17 +22,12 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <commonlib/helpers.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
|
||||||
/* Endianess */
|
/* Endianess */
|
||||||
#include "swab.h"
|
#include "swab.h"
|
||||||
|
|
||||||
/* Helpers */
|
|
||||||
#define ARRAY_SIZE(a) (int)(sizeof(a) / sizeof((a)[0]))
|
|
||||||
#define ALIGN(val, by) (((val) + (by)-1)&~((by)-1))
|
|
||||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
|
||||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
|
||||||
|
|
||||||
#define IS_TOP_ALIGNED_ADDRESS(x) ((uint32_t)(x) > 0x80000000)
|
#define IS_TOP_ALIGNED_ADDRESS(x) ((uint32_t)(x) > 0x80000000)
|
||||||
|
|
||||||
#define unused __attribute__((unused))
|
#define unused __attribute__((unused))
|
||||||
|
|
|
@ -595,7 +595,7 @@ out:
|
||||||
int rmodule_init(struct rmod_context *ctx, const struct buffer *elfin)
|
int rmodule_init(struct rmod_context *ctx, const struct buffer *elfin)
|
||||||
{
|
{
|
||||||
struct parsed_elf *pelf;
|
struct parsed_elf *pelf;
|
||||||
int i;
|
size_t i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
Loading…
Reference in New Issue