How to cast "ptr" to assign directly a zend_long into it without writing two lines?
zend_long *val = *ptr;
*val = *(ISC_LONG*)var->sqldata;
How to cast "ptr" to assign directly a zend_long into it without writing two lines?
zend_long *val = *ptr;
*val = *(ISC_LONG*)var->sqldata;
Assuming that your original code is correct, the corresponding assignment looks like this:
*((zend_long*)*ptr) = *(ISC_LONG*)var->sqldata;
Pointer casts like these are not well-defined behavior in C, unless the two structs happen to be compatible types. That is, they have to have identical members in identical order.
If they don't have that, then there is unfortunately no easy way to do this in C. If you somehow managed to get it to "work" it is merely out of luck - your code could crash at any time because of undefined behavior.
This is because such casts violate the so-called strict aliasing rule. You will have to dodge that rule by for example wrapping the structs inside a union type.