Save the normal from your gravity trace in another VECTOR, f.i.
VECTOR normal_save;
...
c_trace(...)
vec_set(normal_save,normal);
When you now collide with a wall, the normal vector will be set to the collision surface's normal. Compare those two vectors.
Besides, you do not need to do that at all, because you normally only trace vertically down (or up). Then just check the normal.z value of the wall (see manual).