Init: Remove unused variables

For build-system CFLAGS clean-up, fix unused variables.

Use a #define instead of static variable in a header file.

Change-Id: Id47bf38e51644b61a9f3ac1893a16553695f1aac
This commit is contained in:
Andreas Gampe 2014-11-24 19:52:41 -08:00
parent 1690b49e63
commit a016c42b4f
6 changed files with 9 additions and 30 deletions

View File

@ -501,7 +501,6 @@ int do_mount_all(int nargs, char **args)
int ret = -1;
int child_ret = -1;
int status;
const char *prop;
struct fstab *fstab;
if (nargs != 2) {

View File

@ -191,7 +191,6 @@ static bool perm_path_matches(const char *path, struct perms_ *dp)
static mode_t get_device_perm(const char *path, const char **links,
unsigned *uid, unsigned *gid)
{
mode_t perm;
struct listnode *node;
struct perm_node *perm_node;
struct perms_ *dp;
@ -497,15 +496,10 @@ static char **get_block_device_symlinks(struct uevent *uevent)
struct platform_node *pdev;
char *slash;
const char *type;
int width;
char buf[256];
char link_path[256];
int fd;
int link_num = 0;
int ret;
char *p;
unsigned int size;
struct stat info;
pdev = find_platform_device(uevent->path);
if (pdev) {
@ -926,7 +920,6 @@ root_free_out:
static void handle_firmware_event(struct uevent *uevent)
{
pid_t pid;
int ret;
if(strcmp(uevent->subsystem, "firmware"))
return;
@ -1045,15 +1038,18 @@ void device_init(void)
fcntl(device_fd, F_SETFD, FD_CLOEXEC);
fcntl(device_fd, F_SETFL, O_NONBLOCK);
if (stat(coldboot_done, &info) < 0) {
if (stat(COLDBOOT_DONE, &info) < 0) {
t0 = get_usecs();
coldboot("/sys/class");
coldboot("/sys/block");
coldboot("/sys/devices");
t1 = get_usecs();
fd = open(coldboot_done, O_WRONLY|O_CREAT, 0000);
fd = open(COLDBOOT_DONE, O_WRONLY|O_CREAT, 0000);
close(fd);
log_event_print("coldboot %ld uS\n", ((long) (t1 - t0)));
// t0 & t1 are unused if the log isn't doing anything.
(void)t0;
(void)t1;
} else {
log_event_print("skipping coldboot, already done\n");
}

View File

@ -76,7 +76,6 @@ static char qemu[32];
static struct action *cur_action = NULL;
static struct command *cur_command = NULL;
static struct listnode *command_queue = NULL;
void notify_service_state(const char *name, const char *state)
{
@ -170,7 +169,6 @@ void service_start(struct service *svc, const char *dynamic_args)
struct stat s;
pid_t pid;
int needs_console;
int n;
char *scon = NULL;
int rc;
@ -578,10 +576,10 @@ void execute_one_command(void)
static int wait_for_coldboot_done_action(int nargs, char **args)
{
int ret;
INFO("wait for %s\n", coldboot_done);
ret = wait_for_file(coldboot_done, COMMAND_RETRY_TIMEOUT);
INFO("wait for %s\n", COLDBOOT_DONE);
ret = wait_for_file(COLDBOOT_DONE, COMMAND_RETRY_TIMEOUT);
if (ret)
ERROR("Timed out waiting for %s\n", coldboot_done);
ERROR("Timed out waiting for %s\n", COLDBOOT_DONE);
return ret;
}
@ -1003,9 +1001,6 @@ int main(int argc, char **argv)
{
int fd_count = 0;
struct pollfd ufds[4];
char *tmpdev;
char* debuggable;
char tmp[32];
int property_set_fd_init = 0;
int signal_fd_init = 0;
int keychord_fd_init = 0;

View File

@ -187,19 +187,14 @@ static int push_chars(char **dst, int *len, const char *chars, int cnt)
int expand_props(char *dst, const char *src, int dst_size)
{
int cnt = 0;
char *dst_ptr = dst;
const char *src_ptr = src;
int src_len;
int idx = 0;
int ret = 0;
int left = dst_size - 1;
if (!src || !dst || dst_size == 0)
return -1;
src_len = strlen(src);
/* - variables can either be $x.y or ${x.y}, in case they are only part
* of the string.
* - will accept $$ as a literal $.
@ -847,7 +842,6 @@ static void parse_line_action(struct parse_state* state, int nargs, char **args)
{
struct command *cmd;
struct action *act = state->context;
int (*func)(int nargs, char **args);
int kw, n;
if (nargs == 0) {

View File

@ -63,7 +63,6 @@ typedef struct {
static int init_workspace(workspace *w, size_t size)
{
void *data;
int fd = open(PROP_FILENAME, O_RDONLY | O_NOFOLLOW);
if (fd < 0)
return -1;
@ -142,9 +141,6 @@ static int check_control_mac_perms(const char *name, char *sctx)
*/
static int check_perms(const char *name, char *sctx)
{
int i;
unsigned int app_id;
if(!strncmp(name, "ro.", 3))
name +=3;
@ -261,7 +257,6 @@ void handle_property_set_fd()
prop_msg msg;
int s;
int r;
int res;
struct ucred cr;
struct sockaddr_un addr;
socklen_t addr_size = sizeof(addr);

View File

@ -22,7 +22,7 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
static const char *coldboot_done = "/dev/.coldboot_done";
#define COLDBOOT_DONE "/dev/.coldboot_done"
int mtd_name_to_number(const char *name);
int create_socket(const char *name, int type, mode_t perm,