Message ID | 20181114160221.18242-2-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show |
Series | Support for links into sw-description. | expand |
Hi Stefano, Am 14.11.18 um 17:02 schrieb Stefano Babic: > Signed-off-by: Stefano Babic <sbabic@denx.de> > > --- > > Changes in v2: > - Use "ref" attribute to set a link > - Use separators to identify part of link > - Explicitely set links instead of implicitely set > via strings. > - Allow to link any attribute in sw-description > not just the root node. > - Several cleanup > - Note: this is quite a complete new version, most > code from V1 was rewritten it would be nice if you could add the changes in the affected patch. > > core/util.c | 16 ++++++++++++++++ > include/util.h | 1 + > 2 files changed, 17 insertions(+) > > diff --git a/core/util.c b/core/util.c > index 15d38b7..a357ea3 100644 > --- a/core/util.c > +++ b/core/util.c > @@ -481,6 +481,22 @@ char** string_split(const char* in, const char d) > return result; > } > > +/* > + * Count number of elements in an array of strings > + * Last item must have a NULL terminator > + */ > +unsigned int count_string_array(const char **nodes) > +{ > + const char **iter = nodes; > + int count = 0; > + > + while (*iter != NULL) { > + iter++; > + count++; > + } > + return count; > +} > + > unsigned long long ustrtoull(const char *cp, unsigned int base) > { > errno = 0; > diff --git a/include/util.h b/include/util.h > index 06f4a83..0a95967 100644 > --- a/include/util.h > +++ b/include/util.h > @@ -179,6 +179,7 @@ void get_sw_versions(char *cfgfname, struct swupdate_cfg *sw); > __u64 version_to_number(const char *version_string); > int check_hw_compatibility(struct swupdate_cfg *cfg); > int count_elem_list(struct imglist *list); > +unsigned int count_string_array(const char **nodes); > > /* Decryption key functions */ > int load_decryption_key(char *fname); >
Hi Stefan, note: as I have not seen any comment, I merged the set before you told me you had review the patches. I will fix your comments with follow-up patches, then. On 23/11/18 21:57, Stefan Herbrechtsmeier wrote: > Hi Stefano, > > Am 14.11.18 um 17:02 schrieb Stefano Babic: >> Signed-off-by: Stefano Babic <sbabic@denx.de> >> >> --- >> >> Changes in v2: >> - Use "ref" attribute to set a link >> - Use separators to identify part of link >> - Explicitely set links instead of implicitely set >> via strings. >> - Allow to link any attribute in sw-description >> not just the root node. >> - Several cleanup >> - Note: this is quite a complete new version, most >> code from V1 was rewritten > > it would be nice if you could add the changes in the affected patch. Right - this was a misuse of the "patman" tool that I use to generate patches. Regards, Stefano > >> >> core/util.c | 16 ++++++++++++++++ >> include/util.h | 1 + >> 2 files changed, 17 insertions(+) >> >> diff --git a/core/util.c b/core/util.c >> index 15d38b7..a357ea3 100644 >> --- a/core/util.c >> +++ b/core/util.c >> @@ -481,6 +481,22 @@ char** string_split(const char* in, const char d) >> return result; >> } >> +/* >> + * Count number of elements in an array of strings >> + * Last item must have a NULL terminator >> + */ >> +unsigned int count_string_array(const char **nodes) >> +{ >> + const char **iter = nodes; >> + int count = 0; >> + >> + while (*iter != NULL) { >> + iter++; >> + count++; >> + } >> + return count; >> +} >> + >> unsigned long long ustrtoull(const char *cp, unsigned int base) >> { >> errno = 0; >> diff --git a/include/util.h b/include/util.h >> index 06f4a83..0a95967 100644 >> --- a/include/util.h >> +++ b/include/util.h >> @@ -179,6 +179,7 @@ void get_sw_versions(char *cfgfname, struct >> swupdate_cfg *sw); >> __u64 version_to_number(const char *version_string); >> int check_hw_compatibility(struct swupdate_cfg *cfg); >> int count_elem_list(struct imglist *list); >> +unsigned int count_string_array(const char **nodes); >> /* Decryption key functions */ >> int load_decryption_key(char *fname); >> >
diff --git a/core/util.c b/core/util.c index 15d38b7..a357ea3 100644 --- a/core/util.c +++ b/core/util.c @@ -481,6 +481,22 @@ char** string_split(const char* in, const char d) return result; } +/* + * Count number of elements in an array of strings + * Last item must have a NULL terminator + */ +unsigned int count_string_array(const char **nodes) +{ + const char **iter = nodes; + int count = 0; + + while (*iter != NULL) { + iter++; + count++; + } + return count; +} + unsigned long long ustrtoull(const char *cp, unsigned int base) { errno = 0; diff --git a/include/util.h b/include/util.h index 06f4a83..0a95967 100644 --- a/include/util.h +++ b/include/util.h @@ -179,6 +179,7 @@ void get_sw_versions(char *cfgfname, struct swupdate_cfg *sw); __u64 version_to_number(const char *version_string); int check_hw_compatibility(struct swupdate_cfg *cfg); int count_elem_list(struct imglist *list); +unsigned int count_string_array(const char **nodes); /* Decryption key functions */ int load_decryption_key(char *fname);
Signed-off-by: Stefano Babic <sbabic@denx.de> --- Changes in v2: - Use "ref" attribute to set a link - Use separators to identify part of link - Explicitely set links instead of implicitely set via strings. - Allow to link any attribute in sw-description not just the root node. - Several cleanup - Note: this is quite a complete new version, most code from V1 was rewritten core/util.c | 16 ++++++++++++++++ include/util.h | 1 + 2 files changed, 17 insertions(+)