Fix the macro to allow it to return something.

This commit is contained in:
Danila Fedorin 2017-02-03 21:02:07 -08:00
parent 01d49eb397
commit d753bbe1ab

View File

@ -8,7 +8,7 @@
* to be copied. This requires at least 3 things - set the x value, set the y value, call the * to be copied. This requires at least 3 things - set the x value, set the y value, call the
* hash table function the requires the key. These macros take care of these three things. * hash table function the requires the key. These macros take care of these three things.
*/ */
#define PAIRMAP_PUT(map, tmp, newx, newy, data) do { (tmp)->x = newx; (tmp)->y = newy; ht_put(map, tmp, data); } while(0) #define PAIRMAP_PUT(map, tmp, newx, newy, data) ((tmp)->x = newx, (tmp)->y = newy, ht_put(map, tmp, data))
#define PAIRMAP_GET(map, tmp, newx, newy) ((tmp)->x = newx, (tmp)->y = newy, ht_get(map, tmp)) #define PAIRMAP_GET(map, tmp, newx, newy) ((tmp)->x = newx, (tmp)->y = newy, ht_get(map, tmp))
#include "ht.h" #include "ht.h"