LCDproc development and user support list

Text archives Help


[Lcdproc] [PATCH] MtxOrb.c for both 0.4.5 & 0.5


Chronological Thread 
  • From: lcdproc AT neko.me.uk (Chris Lansley)
  • Subject: [Lcdproc] [PATCH] MtxOrb.c for both 0.4.5 & 0.5
  • Date: Wed Sep 15 18:30:03 2004

Hi Joris,

Thank you so much for taking time to comment on this code - I really =
mean that.

> > s =3D config_get_string ( sectionname, keyname, 0, NULL);
> > if (s !=3D NULL){
> > + return_val =3D *s;
> > } else {
> > return_val=3Ddefault_value;
> > }
>=20
> I don't know what this string is used for, but you should know that=20
> strings returned by config_* functions are not your 'property'. The=20
> buffers that contain the strings will be reused by the config stuff. =
That=20
> may not be a problem if the string is only scanned once or something. =
If=20
> that is so, a comment should be placed here telling that the string is =

> 'property' of the config stuff and can only be used immediately after=20
> this. If you assume the string is 'yours' you have introduced a =
problem=20
> with the code, which should be fixed ;)
> Decide what to do with this info yourself, I don't know the driver =
very=20
> well and have not taken the time to review this all in context.

The code listed above is the whole extent of that string's use. Notice =
that I'm not returning the string but the first character of that string =
(i.e. I've deferenced the pointer to a char, so ended up with a char not =
the string).

So the I feel the code is safe - if however I think I've misunderstood =
you then please comment again!

Chris.







Archive powered by MHonArc 2.6.18.

Top of page