internal/platform_name: move to const char*
Instead of plain char* to avoid need to malloc and do all the needed error checking needed that goes along with that. Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -40,13 +40,7 @@ mraa_intel_de3815()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
if (b->platform_name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->platform_name = PLATFORM_NAME;
|
||||
b->phy_pin_count = 18;
|
||||
//b->gpio_count = 14;
|
||||
b->aio_count = 0;
|
||||
|
||||
@@ -1080,13 +1080,7 @@ mraa_intel_edison_fab_c()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
if (b->platform_name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->platform_name = PLATFORM_NAME;
|
||||
// This seciton will also check if the arduino board is there
|
||||
tristate = mraa_gpio_init_raw(214);
|
||||
if (tristate == NULL) {
|
||||
|
||||
@@ -125,13 +125,7 @@ mraa_intel_galileo_rev_d()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
if (b->platform_name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->platform_name = PLATFORM_NAME;
|
||||
b->phy_pin_count = 20;
|
||||
b->gpio_count = 14;
|
||||
b->aio_count = 6;
|
||||
|
||||
@@ -326,13 +326,7 @@ mraa_intel_galileo_gen2()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
if (b->platform_name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->platform_name = PLATFORM_NAME;
|
||||
b->phy_pin_count = 20;
|
||||
b->gpio_count = 14;
|
||||
b->aio_count = 6;
|
||||
|
||||
@@ -87,13 +87,7 @@ mraa_intel_minnow_max()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b->platform_name_length = strlen(PLATFORM_NAME) + 1;
|
||||
b->platform_name = (char*) malloc(sizeof(char) * b->platform_name_length);
|
||||
if (b->platform_name == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->platform_name, PLATFORM_NAME, b->platform_name_length);
|
||||
|
||||
b->platform_name = PLATFORM_NAME;
|
||||
b->phy_pin_count = MRAA_INTEL_MINNOW_MAX_PINCOUNT;
|
||||
b->gpio_count = MRAA_INTEL_MINNOW_MAX_PINCOUNT;
|
||||
b->aio_count = 0;
|
||||
|
||||
Reference in New Issue
Block a user