On Tue, Apr 16, 2013 at 04:55:14PM -0700, Eric Anholt wrote:
> Topi Pohjolainen <topi.pohjolai...@intel.com> writes:
> 
> > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
> > ---
> >  src/mesa/drivers/dri/intel/intel_screen.c | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
> > b/src/mesa/drivers/dri/intel/intel_screen.c
> > index 46193b5..3d0344e 100644
> > --- a/src/mesa/drivers/dri/intel/intel_screen.c
> > +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> > @@ -250,6 +250,21 @@ static struct intel_image_format intel_image_formats[] 
> > = {
> >         { 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } }
> >  };
> >  
> > +static struct intel_image_format *
> > +intel_image_format_lookup(int fourcc)
> > +{
> > +   struct intel_image_format *f = 0;
> > +
> > +   for (unsigned i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
> > +      if (intel_image_formats[i].fourcc == fourcc) {
> > +    f = &intel_image_formats[i];
> > +    break;
> > +      }
> > +   }
> > +
> > +   return f;
> > +}
> > +
> >  static __DRIimage *
> >  intel_allocate_image(int dri_format, void *loaderPrivate)
> >  {
> > @@ -611,12 +626,7 @@ intel_create_image_from_names(__DRIscreen *screen,
> >      if (screen == NULL || names == NULL || num_names != 1)
> >          return NULL;
> >  
> > -    for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
> > -        if (intel_image_formats[i].fourcc == fourcc) {
> > -           f = &intel_image_formats[i];
> > -        }
> > -    }
> > -
> > +    f = intel_image_format_lookup(fourcc);
> >      if (f == NULL)
> >          return NULL;
> 
> You should reuse this function in the other copy of this loop at the
> same time.

I couldn't find more than one occurence, where did you find another?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to