On Tue, Aug 6, 2013 at 11:39 AM, David Herrmann <dh.herrmann@xxxxxxxxx> wrote: > > On Mon, Aug 5, 2013 at 9:46 AM, Daniel Vetter <daniel@xxxxxxxx> wrote: >> On Sat, Jul 27, 2013 at 01:36:27PM +0200, David Herrmann wrote: >>> Add a "best_match" flag similar to the drm_mm_search_*() helpers so we >>> can convert TTM to use them in follow up patches. We can also inline the >>> non-generic helpers and move them into the header to allow compile-time >>> optimizations. >>> >>> To make calls to drm_mm_{search,insert}_node() more readable, this >>> converts the boolean argument to a flagset. There are pending patches that >>> add additional flags for top-down allocators and more. >>> >>> v2: >>> - use flag parameter instead of boolean "best_match" >>> - convert *_search_free() helpers to also use flags argument >>> >>> Signed-off-by: David Herrmann <dh.herrmann@xxxxxxxxx> >> >> I'm not sure whether the use of an enum here is proper C style (usually >> bitflag arguments tend to be unsigned ints), but that's a bikeshed. So > > I saw it used in libxkbcommon and it's actually pretty nice because > gcc supports some type-safety for it. It checks whether the passed > flags are really from the enum (even if OR/AND-combined). And as it is > no external API, we have no problems with the "enum resizing" once you > add more flags. Hm, I didn't know that gcc checks enums even when they're used as flags with bitwise ops. That makes an enum indeed useful and the better option. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel