There were a couple of places where malloc-failures (out-of-memory,
really) weren't caught. This isn't a big deal on modern operating
systems, but is worth dealing with on low-end platforms.
Failures to add/delete keys should count as socket-errors, because
they cause the editor and client to become out of sync.
Smoothstep[1] is a nice smooth alternative to cosine that
doesn't require special math functons, and should thus be
suitable on more platforms. The cosine-curve and the
smoothstep are very similar, and this change introduces
only a very small error (always less than 1 per cent)
compared to the old result.
Change the smooth curve definition to match this.
[1]: http://en.wikipedia.org/wiki/Smoothstep