Re: canvas item color

On Fri, 8 Jan 1999, Federico Mena Quintero wrote:

> In the meantime, you can do something like
> 	/* Colors are in the [0, 65535] range */
> 	char *
> 	get_color_spec (int r, int g, int b)
> 	{
> 		static char spec[50];
> 		sprintf (spec, "#%04x%04x%04x", r, g, b);
> 		return spec;
> 	}
> and use that as the color spec passed to the fill_color arguments.
> You can modify it as appropriate for colors in the [0, 255] range.

Question from Todd, the notoriously bad C programmer:

Isn't this a memory leak?  Shouldn't the caller be responsible for
allocating spec[] and passing it in?

Todd Graham Lewis      (800) 719-4664, x2804

"It's still ludicrous that nobody's ever made a run at us by making UNIX
 a popular platform on PCs.  It's almost too late now."  -- Steve Balmer
"It is too late."   -- Bill Gates             _Newsweek_, 6/23/97, p. 82

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]