su: Move to cutils/properties.h

* Parsing props manually? Are we crazy or what.
* We're now started from init, we can safely use libcutils

Change-Id: I57b2ff4ec777669f2ad14229045bf1a2e7d222d3
diff --git a/utils.c b/utils.c
index 327f8dc..95d58f8 100644
--- a/utils.c
+++ b/utils.c
@@ -14,16 +14,10 @@
 ** limitations under the License.
 */
 
-#include <sys/types.h>
+#include <fcntl.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include "utils.h"
 
@@ -52,66 +46,3 @@
     if (data) free(data);
     return NULL;
 }
-
-int get_property(const char *data, char *found, const char *searchkey, const char *not_found)
-{
-    char *key, *value, *eol, *sol, *tmp;
-    if (data == NULL) goto defval;
-    int matched = 0;
-    char *dup = strdup(data);
-    if (!dup)
-        goto defval;
-
-    sol = dup;
-    while((eol = strchr(sol, '\n'))) {
-        key = sol;
-        *eol++ = 0;
-        sol = eol;
-
-        value = strchr(key, '=');
-        if(value == 0) continue;
-        *value++ = 0;
-
-        while(isspace(*key)) key++;
-        if(*key == '#') continue;
-        tmp = value - 2;
-        while((tmp > key) && isspace(*tmp)) *tmp-- = 0;
-
-        while(isspace(*value)) value++;
-        tmp = eol - 2;
-        while((tmp > value) && isspace(*tmp)) *tmp-- = 0;
-
-        if (strncmp(searchkey, key, strlen(searchkey)) == 0) {
-            matched = 1;
-            break;
-        }
-    }
-    free(dup);
-    int len;
-    if (matched) {
-        len = strlen(value);
-        if (len >= PROPERTY_VALUE_MAX)
-            return -1;
-        memcpy(found, value, len + 1);
-    } else goto defval;
-    return len;
-
-defval:
-    len = strlen(not_found);
-    memcpy(found, not_found, len + 1);
-    return len;
-}
-
-/*
- * Fast version of get_property which purpose is to check
- * whether the property with given prefix exists.
- *
- * Assume nobody is stupid enough to put a propery with prefix ro.lineage.version
- * in his build.prop on a non-LineageOS ROM and comment it out.
- */
-int check_property(const char *data, const char *prefix)
-{
-    if (!data)
-        return 0;
-    return strstr(data, prefix) != NULL;
-}