MCPcopy Create free account
hub / github.com/Kitware/CMake / Check_Enum_Field

Function Check_Enum_Field

Source/CursesDialog/form/fty_enum.c:161–201  ·  view source on GitHub ↗

--------------------------------------------------------------------------- | Facility : libnform | Function : static bool Check_Enum_Field( | FIELD * field, | const void * argp) | | Description : Validate buffer content to be a valid enumeration value | | Return Values : TRUE - field is valid

Source from the content-addressed store, hash-verified

159| FALSE - field is invalid
160+--------------------------------------------------------------------------*/
161static bool Check_Enum_Field(FIELD * field, const void * argp)
162{
163 char **kwds = ((const enumARG *)argp)->kwds;
164 bool ccase = ((const enumARG *)argp)->checkcase;
165 bool unique = ((const enumARG *)argp)->checkunique;
166 unsigned char *bp = (unsigned char *)field_buffer(field,0);
167 char *s, *t, *p;
168 int res;
169
170 while( kwds && (s=(*kwds++)) )
171 {
172 if ((res=Compare((unsigned char *)s,bp,ccase))!=NOMATCH)
173 {
174 p=t=s; /* t is at least a partial match */
175 if ((unique && res!=EXACT))
176 {
177 while( kwds && (p = *kwds++) )
178 {
179 if ((res=Compare((unsigned char *)p,bp,ccase))!=NOMATCH)
180 {
181 if (res==EXACT)
182 {
183 t = p;
184 break;
185 }
186 else
187 t = (char *)0;
188 }
189 }
190 }
191 if (t)
192 {
193 set_field_buffer(field,0,t);
194 return TRUE;
195 }
196 if (!p)
197 break;
198 }
199 }
200 return FALSE;
201}
202
203static const char *dummy[] = { (char *)0 };
204

Callers

nothing calls this directly

Calls 3

field_bufferFunction · 0.85
CompareFunction · 0.85
set_field_bufferFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…