Ignore:
Timestamp:
2010-03-23T22:58:44Z (14 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5814ef7
Parents:
76ca3f7
Message:

IPC_[SG]ET_ARG macros refactored to be more explicit and safer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/icmp/icmp_messages.h

    r76ca3f7 re417b96  
    8282 *  @param[in] call The message call structure.
    8383 */
    84 #define ICMP_GET_CODE(call)             (icmp_code_t) IPC_GET_ARG1(*call)
     84#define ICMP_GET_CODE(call) \
     85        ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
    8586
    8687/** Returns the ICMP link MTU message parameter.
    8788 *  @param[in] call The message call structure.
    8889 */
    89 #define ICMP_GET_MTU(call)              (icmp_param_t) IPC_GET_ARG3(*call)
     90#define ICMP_GET_MTU(call) \
     91        ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
    9092
    9193/** Returns the pointer message parameter.
    9294 *  @param[in] call The message call structure.
    9395 */
    94 #define ICMP_GET_POINTER(call)          (icmp_param_t) IPC_GET_ARG3(*call)
     96#define ICMP_GET_POINTER(call) \
     97        ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
    9598
    9699/** Returns the size message parameter.
    97100 *  @param[in] call The message call structure.
    98101 */
    99 #define ICMP_GET_SIZE(call)     (size_t) IPC_GET_ARG1(call)
     102#define ICMP_GET_SIZE(call) \
     103        ({size_t size = (size_t) IPC_GET_ARG1(call); size;})
    100104
    101105/** Returns the timeout message parameter.
    102106 *  @param[in] call The message call structure.
    103107 */
    104 #define ICMP_GET_TIMEOUT(call)  ((suseconds_t) IPC_GET_ARG2(call))
     108#define ICMP_GET_TIMEOUT(call) \
     109        (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
    105110
    106111/** Returns the time to live message parameter.
    107112 *  @param[in] call The message call structure.
    108113 */
    109 #define ICMP_GET_TTL(call)      (ip_ttl_t) IPC_GET_ARG3(call)
     114#define ICMP_GET_TTL(call) \
     115        ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
    110116
    111117/** Returns the type of service message parameter.
    112118 *  @param[in] call The message call structure.
    113119 */
    114 #define ICMP_GET_TOS(call)      (ip_tos_t) IPC_GET_ARG4(call)
     120#define ICMP_GET_TOS(call) \
     121        ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
    115122
    116123/** Returns the dont fragment message parameter.
    117124 *  @param[in] call The message call structure.
    118125 */
    119 #define ICMP_GET_DONT_FRAGMENT(call)            (int) IPC_GET_ARG5(call)
     126#define ICMP_GET_DONT_FRAGMENT(call) \
     127        ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
    120128
    121129/*@}*/
Note: See TracChangeset for help on using the changeset viewer.