arpadboda commented on a change in pull request #674: Minificpp 1007 - ECU C2 integration. URL: https://github.com/apache/nifi-minifi-cpp/pull/674#discussion_r353265177
########## File path: nanofi/ecu/c2_client.c ########## @@ -0,0 +1,235 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include <coap/c2structs.h> +#include <coap/c2protocol.h> +#include <coap/c2agent.h> +#include <c2_api/c2api.h> +#include <api/ecu.h> + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#include "utlist.h" +#include "uthash.h" + +typedef struct config_params { + char * key; // name of the param + char * value; // value of the param + UT_hash_handle hh; +} config_params; + +char ** parse_line(char * line, size_t len) { + char * tok = strtok(line, " ="); + char ** tokens = (char **)malloc(sizeof(char *) * 2); + int i = 0; + while (tok) { + if (i > 2) break; + size_t s = strlen(tok); + char * token = (char *)malloc(sizeof(char) * (s + 1)); + memset(token, 0, (s + 1)); + strcpy(token, tok); + tokens[i++] = token; + tok = strtok(NULL, " =\n"); Review comment: We have different separator here than in line 24. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services