Remove char/string conversions in fstab processing

There a few char->string conversions between functions which handle
different parts of fstab line processing, but there are no uses of
string functions. Pass char arrays/pointers around instead.

Change-Id: I976a9a54ee8dcfb6194cadcac6a34e467602003b
diff --git a/partition.cpp b/partition.cpp
index bdc8dcb..5bbde2c 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -235,14 +235,14 @@
 	// Do nothing
 }
 
-bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
-	char full_line[MAX_FSTAB_LINE_LENGTH], item[MAX_FSTAB_LINE_LENGTH];
+bool TWPartition::Process_Fstab_Line(const char *fstab_line, bool Display_Error) {
+	char full_line[MAX_FSTAB_LINE_LENGTH];
 	char twflags[MAX_FSTAB_LINE_LENGTH] = "";
-	int line_len = Line.size(), index = 0, item_index = 0;
 	char* ptr;
-	strncpy(full_line, Line.c_str(), line_len);
+	int line_len = strlen(fstab_line), index = 0, item_index = 0;
 	bool skip = false;
 
+	strlcpy(full_line, fstab_line, sizeof(full_line));
 	for (index = 0; index < line_len; index++) {
 		if (full_line[index] == 34)
 			skip = !skip;
@@ -283,9 +283,9 @@
 					LOGERR("Until we get better BML support, you will have to find and provide the full block device path to the BML devices e.g. /dev/block/bml9 instead of the partition name\n");
 			} else if (*ptr != '/') {
 				if (Display_Error)
-					LOGERR("Invalid block device on '%s', '%s', %i\n", Line.c_str(), ptr, index);
+					LOGERR("Invalid block device '%s' in fstab line '%s'", ptr, fstab_line);
 				else
-					LOGINFO("Invalid block device on '%s', '%s', %i\n", Line.c_str(), ptr, index);
+					LOGINFO("Invalid block device '%s' in fstab line '%s'", ptr, fstab_line);
 				return 0;
 			} else {
 				Primary_Block_Device = ptr;
@@ -310,7 +310,7 @@
 				// Do nothing
 			} else {
 				// Unhandled data
-				LOGINFO("Unhandled fstab information: '%s', %i, line: '%s'\n", ptr, index, Line.c_str());
+				LOGINFO("Unhandled fstab information '%s' in fstab line '%s'\n", ptr, fstab_line);
 			}
 		}
 		while (index < line_len && full_line[index] != '\0')
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index 95d2520..cc36b2e 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -90,11 +90,9 @@
 
 		if (fstab_line[strlen(fstab_line) - 1] != '\n')
 			fstab_line[strlen(fstab_line)] = '\n';
-		TWPartition* partition = new TWPartition();
-		string line = fstab_line;
-		memset(fstab_line, 0, sizeof(fstab_line));
 
-		if (partition->Process_Fstab_Line(line, Display_Error)) {
+		TWPartition* partition = new TWPartition();
+		if (partition->Process_Fstab_Line(fstab_line, Display_Error)) {
 			if (partition->Is_Storage) {
 				++storageid;
 				partition->MTP_Storage_ID = storageid;
@@ -113,6 +111,8 @@
 		} else {
 			delete partition;
 		}
+
+		memset(fstab_line, 0, sizeof(fstab_line));
 	}
 	fclose(fstabFile);
 	if (!datamedia && !settings_partition && Find_Partition_By_Path("/sdcard") == NULL && Find_Partition_By_Path("/internal_sd") == NULL && Find_Partition_By_Path("/internal_sdcard") == NULL && Find_Partition_By_Path("/emmc") == NULL) {
diff --git a/partitions.hpp b/partitions.hpp
index aafc4d4..ab34ec2 100644
--- a/partitions.hpp
+++ b/partitions.hpp
@@ -95,7 +95,7 @@
 	void Setup_Data_Media();                                                  // Sets up a partition as a /data/media emulated storage partition
 
 private:
-	bool Process_Fstab_Line(string Line, bool Display_Error);                 // Processes a fstab line
+	bool Process_Fstab_Line(const char *fstab_line, bool Display_Error);      // Processes a fstab line
 	void Find_Actual_Block_Device();                                          // Determines the correct block device and stores it in Actual_Block_Device
 
 	void Apply_TW_Flag(const unsigned flag, const char* str, const bool val); // Apply custom twrp fstab flags