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
diff --git a/init/builtins.c b/init/builtins.c
index 7f4daa7..5d2a517 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -501,7 +501,6 @@
     int ret = -1;
     int child_ret = -1;
     int status;
-    const char *prop;
     struct fstab *fstab;
 
     if (nargs != 2) {
diff --git a/init/devices.c b/init/devices.c
index a95111a..dde43df 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -191,7 +191,6 @@
 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 @@
     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 @@
 static void handle_firmware_event(struct uevent *uevent)
 {
     pid_t pid;
-    int ret;
 
     if(strcmp(uevent->subsystem, "firmware"))
         return;
@@ -1045,15 +1038,18 @@
     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");
     }
diff --git a/init/init.c b/init/init.c
index 99474e6..2b82937 100644
--- a/init/init.c
+++ b/init/init.c
@@ -76,7 +76,6 @@
 
 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 @@
     struct stat s;
     pid_t pid;
     int needs_console;
-    int n;
     char *scon = NULL;
     int rc;
 
@@ -578,10 +576,10 @@
 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 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;
diff --git a/init/init_parser.c b/init/init_parser.c
index 6466db2..2b4db8e 100644
--- a/init/init_parser.c
+++ b/init/init_parser.c
@@ -187,19 +187,14 @@
 
 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 @@
 {
     struct command *cmd;
     struct action *act = state->context;
-    int (*func)(int nargs, char **args);
     int kw, n;
 
     if (nargs == 0) {
diff --git a/init/property_service.c b/init/property_service.c
index 44658c5..1f98e13 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -63,7 +63,6 @@
 
 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_perms(const char *name, char *sctx)
 {
-    int i;
-    unsigned int app_id;
-
     if(!strncmp(name, "ro.", 3))
         name +=3;
 
@@ -261,7 +257,6 @@
     prop_msg msg;
     int s;
     int r;
-    int res;
     struct ucred cr;
     struct sockaddr_un addr;
     socklen_t addr_size = sizeof(addr);
diff --git a/init/util.h b/init/util.h
index 04b8129..4cfe99d 100644
--- a/init/util.h
+++ b/init/util.h
@@ -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,