MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / get_fields

Function get_fields

libhb/ssautil.c:331–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331static char ** get_fields(char * line, int last)
332{
333 int count = 0, ii;
334 char * pos;
335
336 if (line == NULL || *line == 0)
337 {
338 return NULL;
339 }
340
341 // count number of fields
342 count = 1;
343 pos = line;
344 while ((pos = strchr(pos, ',')) != NULL)
345 {
346 count++;
347 pos++;
348 }
349 if (last > 0 && count > last)
350 {
351 count = last;
352 }
353 char ** result = calloc(count + 1, sizeof(char*));
354 pos = line;
355 for (ii = 0; ii < count - 1; ii++)
356 {
357 result[ii] = get_field(&pos);
358 }
359 result[ii] = pos != NULL ? strdup(pos) : NULL;
360
361 return result;
362}
363
364static int field_index(char ** fields, char * name)
365{

Callers 2

hb_subtitle_style_initFunction · 0.85

Calls 1

get_fieldFunction · 0.85

Tested by

no test coverage detected