Print this page
12826 update to smatch 0.6.1-rc1-il-6


2702                 state_name++;
2703         }
2704 
2705         /* ten out of ten stars! */
2706         if (star_cnt > 10)
2707                 return NULL;
2708 
2709         if (strncmp(state_name, "(*", 2) == 0 &&
2710             strncmp(state_name + 2, param_name, name_len) == 0 &&
2711             state_name[name_len + 2] == ')') {
2712                 snprintf(buf, sizeof(buf), "%.*s(*$)%s", star_cnt, "**********",
2713                          state_name + name_len + 3);
2714                 return alloc_sname(buf);
2715         }
2716 
2717         if (strcmp(state_name, param_name) == 0) {
2718                 snprintf(buf, sizeof(buf), "%.*s$", star_cnt, "**********");
2719                 return alloc_sname(buf);
2720         }
2721 
2722         if (state_name[name_len] == '-' && /* check for '-' from "->" */
2723             strncmp(state_name, param_name, name_len) == 0) {

2724                 snprintf(buf, sizeof(buf), "%.*s$%s", star_cnt, "**********", state_name + name_len);
2725                 return alloc_sname(buf);
2726         }
2727         return NULL;
2728 }
2729 
2730 const char *get_param_name_var_sym(const char *name, struct symbol *sym)
2731 {
2732         if (!sym || !sym->ident)
2733                 return NULL;
2734 
2735         return state_name_to_param_name(name, sym->ident->name);
2736 }
2737 
2738 const char *get_mtag_name_var_sym(const char *state_name, struct symbol *sym)
2739 {
2740         struct symbol *type;
2741         const char *sym_name;
2742         int name_len;
2743         static char buf[256];




2702                 state_name++;
2703         }
2704 
2705         /* ten out of ten stars! */
2706         if (star_cnt > 10)
2707                 return NULL;
2708 
2709         if (strncmp(state_name, "(*", 2) == 0 &&
2710             strncmp(state_name + 2, param_name, name_len) == 0 &&
2711             state_name[name_len + 2] == ')') {
2712                 snprintf(buf, sizeof(buf), "%.*s(*$)%s", star_cnt, "**********",
2713                          state_name + name_len + 3);
2714                 return alloc_sname(buf);
2715         }
2716 
2717         if (strcmp(state_name, param_name) == 0) {
2718                 snprintf(buf, sizeof(buf), "%.*s$", star_cnt, "**********");
2719                 return alloc_sname(buf);
2720         }
2721 
2722         /* check for '-' from "->" */
2723         if (strncmp(state_name, param_name, name_len) == 0 &&
2724             state_name[name_len] == '-') {
2725                 snprintf(buf, sizeof(buf), "%.*s$%s", star_cnt, "**********", state_name + name_len);
2726                 return alloc_sname(buf);
2727         }
2728         return NULL;
2729 }
2730 
2731 const char *get_param_name_var_sym(const char *name, struct symbol *sym)
2732 {
2733         if (!sym || !sym->ident)
2734                 return NULL;
2735 
2736         return state_name_to_param_name(name, sym->ident->name);
2737 }
2738 
2739 const char *get_mtag_name_var_sym(const char *state_name, struct symbol *sym)
2740 {
2741         struct symbol *type;
2742         const char *sym_name;
2743         int name_len;
2744         static char buf[256];