Is it possible to create one function instead two functions of same purpose but different argument type?
I have two functions written in C, they convert image from RGB to HSV:
void png_rgb2hsv(pPNG_DATA data);
void jpg_rgb2hsv(pJPEG_DATA data);
they do exactly same thing: they take data->row_pointers and cycle it in a loop data->height times. Then it convert the values referred by data->row_pointers. This is how it works. But the only difference is that the data structures use different types. It seems to me senseless to use two functions for same thing. Especially when I would add more functions for more color spaces.
How this problem of program design is solved in practice in C?
Update: Most of readers didn't understand the question. I did not asked about overloading. It was question about design. I ask if is it possible to remove redundant function, "redundant" code. Because both functions are using same code, do the same thing, but the types in the function argument are different because one type is from libjpeg and the second type is from libpng. What I found is that it is not possible because it would mean use one variable for two different types.