MCPcopy Create free account
hub / github.com/apache/nuttx / compare_variables

Function compare_variables

tools/cmpconfig.c:53–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53static int compare_variables(struct variable_s *list1,
54 struct variable_s *list2)
55{
56 char *varval1;
57 char *varval2;
58 int ret = 0;
59
60 while (list1 || list2)
61 {
62 if (list1 && list1->val)
63 {
64 varval1 = list1->val;
65 }
66 else
67 {
68 varval1 = "<NULL>";
69 }
70
71 if (list2 && list2->val)
72 {
73 varval2 = list2->val;
74 }
75 else
76 {
77 varval2 = "<NULL>";
78 }
79
80 if (!list1)
81 {
82 printf("file1:\n");
83 printf("file2: %s=%s\n\n", list2->var, varval2);
84 list2 = list2->flink;
85 ret = EXIT_FAILURE;
86 }
87 else if (!list2)
88 {
89 printf("file1: %s=%s\n", list1->var, varval1);
90 printf("file2:\n\n");
91 list1 = list1->flink;
92 ret = EXIT_FAILURE;
93 }
94 else
95 {
96 int result;
97
98 result = strcmp(list1->var, list2->var);
99 if (result < 0)
100 {
101 printf("file1: %s=%s\n", list1->var, varval1);
102 printf("file2:\n\n");
103 list1 = list1->flink;
104 ret = EXIT_FAILURE;
105 }
106 else if (result > 0)
107 {
108 printf("file1:\n");
109 printf("file2: %s=%s\n\n", list2->var, varval2);
110 list2 = list2->flink;

Callers 1

mainFunction · 0.85

Calls 2

printfFunction · 0.85
strcmpFunction · 0.50

Tested by

no test coverage detected