Comment 1 for bug 776532

Revision history for this message
Scott James Remnant (scott) wrote :

(as discussed today)

I see the problem; there are, as you say, two data pointers here; nih_dir_walk_scan() needs its data pointer passed to its visitor function, but is passing an external filter from the watch which needs an entirely different data pointer (from the watch).

The right fix without busting API would be to change step 4

nih_dir_walk() should pass filter=nih_dir_walk_filter, a new static function that expects data=watch

that static function then simply calls

  return watch->filter (watch->data, ...)

passing in the rest of the arguments.

That way data=watch is passed to both nih_dir_walk()s filter and visit, and the special filter translates it to the watch's filter passing in the watch's data