take fast case in swap() if we're using malloc OR we're empty

This avoids taking the (more expensive) copy case when we don't need to.
The old behavior only took this fast case if we were "actively" using
a dynamically allocated array.

BUG=skia:

Change-Id: I0f606ba83ff4aff3a8fc282db7a3ce1b0191fb1a
Reviewed-on: https://skia-review.googlesource.com/9521
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
1 file changed