Reviewed-by: Ping Cheng <pingli...@gmail.com> Ping
On Tue, Jun 1, 2010 at 9:43 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote: > There was only one malloc for it and that was hardcoded. Just add it to the > struct as-is. > > Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> > --- > src/wcmCommon.c | 13 +++++-------- > src/wcmConfig.c | 3 --- > src/wcmFilter.c | 13 ------------- > src/xf86WacomDefs.h | 2 +- > 4 files changed, 6 insertions(+), 25 deletions(-) > > diff --git a/src/wcmCommon.c b/src/wcmCommon.c > index 5a08e21..1aeb6a2 100644 > --- a/src/wcmCommon.c > +++ b/src/wcmCommon.c > @@ -1679,16 +1679,13 @@ void wcmSoftOutEvent(LocalDevicePtr local) > > static void transPressureCurve(WacomDevicePtr pDev, WacomDeviceStatePtr > pState) > { > - if (pDev->pPressCurve) > - { > - /* clip the pressure */ > - int p = max(0, pState->pressure); > + /* clip the pressure */ > + int p = max(0, pState->pressure); > > - p = min(FILTER_PRESSURE_RES, p); > + p = min(FILTER_PRESSURE_RES, p); > > - /* apply pressure curve function */ > - p = pDev->pPressCurve[p]; > - } > + /* apply pressure curve function */ > + p = pDev->pPressCurve[p]; > } > > /***************************************************************************** > diff --git a/src/wcmConfig.c b/src/wcmConfig.c > index 4931a3d..16a6dbe 100644 > --- a/src/wcmConfig.c > +++ b/src/wcmConfig.c > @@ -290,9 +290,6 @@ static void wcmUninit(InputDriverPtr drv, LocalDevicePtr > local, int flags) > dev = dev->next; > } > > - /* free pressure curve */ > - free(priv->pPressCurve); > - > free(priv); > local->private = NULL; > > diff --git a/src/wcmFilter.c b/src/wcmFilter.c > index aa4aa4e..eff7822 100644 > --- a/src/wcmFilter.c > +++ b/src/wcmFilter.c > @@ -62,19 +62,6 @@ void wcmSetPressureCurve(WacomDevicePtr pDev, int x0, int > y0, > if (!wcmCheckPressureCurveValues(x0, y0, x1, y1)) > return; > > - /* if curve is not allocated, do it now. */ > - if (!pDev->pPressCurve) > - { > - pDev->pPressCurve = (int*) malloc(sizeof(int) * > - (FILTER_PRESSURE_RES + 1)); > - if (!pDev->pPressCurve) > - { > - xf86Msg(X_ERROR, "%s: wcmSetPressureCurve: failed to " > - "allocate memory for curve\n", > pDev->local->name); > - return; > - } > - } > - > /* linear by default */ > for (i=0; i<=FILTER_PRESSURE_RES; ++i) > pDev->pPressCurve[i] = i; > diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h > index 6eab31b..a6d20da 100644 > --- a/src/xf86WacomDefs.h > +++ b/src/xf86WacomDefs.h > @@ -255,7 +255,7 @@ struct _WacomDeviceRec > int throttleValue; /* current throttle value */ > > /* JEJ - filters */ > - int* pPressCurve; /* pressure curve */ > + int pPressCurve[FILTER_PRESSURE_RES]; /* pressure curve */ > int nPressCtrl[4]; /* control points for curve */ > int minPressure; /* the minimum pressure a pen may hold */ > > -- > 1.7.0.1 > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Linuxwacom-devel mailing list > Linuxwacom-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel > ------------------------------------------------------------------------------ _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel