I have a frw hundred lines of code which looks like this
Code:
case 0x0114:
{
struct DisplayNotifyMessage ptr;
memcpy((void*)&ptr,s->receivebuffer,sizeof(struct DisplayNotifyMessage));
#ifdef DEBUG
ptr.m.display();
ptr.display();
#endif
break;
}
case 0x0115:
{
struct ClearNotifyMessage ptr;
memcpy((void*)&ptr,s->receivebuffer,sizeof(struct ClearNotifyMessage));
#ifdef DEBUG
ptr.m.display();
ptr.display();
#endif
break;
}
case 0x0116:
{
struct ActivateCallplaneMessage ptr;
memcpy((void*)&ptr,s->receivebuffer,sizeof(struct ActivateCallplaneMessage));
#ifdef DEBUG
ptr.m.display();
ptr.display();
#endif
break;
}
is there some way i can shorten it... since most of the parts are similar execpt that the structure is different..... please advice