aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index cf8edf4fc429..071f00c3046e 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -750,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym)
750 case no: 750 case no:
751 return "n"; 751 return "n";
752 case mod: 752 case mod:
753 return "m"; 753 sym_calc_value(modules_sym);
754 return (modules_sym->curr.tri == no) ? "n" : "m";
754 case yes: 755 case yes:
755 return "y"; 756 return "y";
756 } 757 }
@@ -892,6 +893,49 @@ const char *sym_expand_string_value(const char *in)
892 return res; 893 return res;
893} 894}
894 895
896const char *sym_escape_string_value(const char *in)
897{
898 const char *p;
899 size_t reslen;
900 char *res;
901 size_t l;
902
903 reslen = strlen(in) + strlen("\"\"") + 1;
904
905 p = in;
906 for (;;) {
907 l = strcspn(p, "\"\\");
908 p += l;
909
910 if (p[0] == '\0')
911 break;
912
913 reslen++;
914 p++;
915 }
916
917 res = malloc(reslen);
918 res[0] = '\0';
919
920 strcat(res, "\"");
921
922 p = in;
923 for (;;) {
924 l = strcspn(p, "\"\\");
925 strncat(res, p, l);
926 p += l;
927
928 if (p[0] == '\0')
929 break;
930
931 strcat(res, "\\");
932 strncat(res, p++, 1);
933 }
934
935 strcat(res, "\"");
936 return res;
937}
938
895struct symbol **sym_re_search(const char *pattern) 939struct symbol **sym_re_search(const char *pattern)
896{ 940{
897 struct symbol *sym, **sym_arr = NULL; 941 struct symbol *sym, **sym_arr = NULL;