Subject Re: UDF problem
Author kittikira
I did not redefine ib_util_malloc.

in my ib_util.h it is defined that way:

extern void *ib_util_malloc(long);

My C knowledge is poor, but isn't void for no return?

And yes, it is only a warning, but when I try to use the udf, firebird closes my connection.

Here is the code of the UDF:
ISC_QUAD * first_day (long * y, long * m)

#ifndef IB_START_YEAR
#define IB_START_YEAR 1900
#endif

ISC_QUAD * first_day (long * , long *);

{
ISC_QUAD *bufquad = (ISC_QUAD *) ib_util_MALLOC (sizeof(ISC_QUAD) + 1);
struct tm tm1;
tm1.tm_sec = 0;
tm1.tm_min = 0;
tm1.tm_hour = 0;
tm1.tm_year = *y - IB_START_YEAR;
tm1.tm_mon = *m - 1;
tm1.tm_mday = 1;
isc_encode_date(&tm1, bufquad);
return bufquad;
}

It should return the date of the first day of a given month in a given year.

Is there something wrong in this function?

--- In firebird-support@yahoogroups.com, Dimitry Sibiryakov <sd@...> wrote:
>
> 25.01.2010 14:26, kittikira wrote:
> > and then I also get the message from the compiler:
> >
> > warning: cast to pointer from integer of different size
>
> At first, this is just a warning. Second, it has nothing to do with
> this code unless you somehow re-defined ib_util_malloc() to return an
> integer.
>
> --
> SY, SD.
>