+ init_array_size = (*trace_hooks)->len;
+
+ /* for each marker with the requested name */
+ do {
+ LttvTraceHook tmpth;
+ int found;
+ GQuark *f;
+ struct marker_field *marker_field;
+
+ marker_id = marker_get_id_from_info(t, info);
+
+ tmpth.h = h;
+ tmpth.id = marker_id;
+ tmpth.hook_data = hook_data;
+ tmpth.fields = g_ptr_array_new();
+
+ /* for each field requested */
+ for(f = fields; f && *f != 0; f++) {
+ found = 0;
+ for_each_marker_field(marker_field, info) {
+ if(marker_field->name == *f) {
+ found = 1;
+ g_ptr_array_add(tmpth.fields, marker_field);
+ break;
+ }
+ }
+ if(!found) {
+ /* Did not find the one of the fields in this instance of the
+ marker. Print a warning and skip this marker completely.
+ Still iterate on other markers with same name. */
+ g_ptr_array_free(tmpth.fields, TRUE);
+ g_warning("Field %s cannot be found in marker %s",
+ g_quark_to_string(*f), g_quark_to_string(marker_name));
+ goto skip_marker;
+ }
+ }
+ /* all fields were found: add the tracehook to the array */
+ *trace_hooks = g_array_append_val(*trace_hooks, tmpth);
+skip_marker:
+ info = info->next;
+ } while(info != NULL);
+
+ /* Error if no new trace hook has been added */
+ if (init_array_size == (*trace_hooks)->len) {
+ g_warning("No marker of name %s has all requested fields",
+ g_quark_to_string(marker_name));
+ return 1;
+ }