Clean up dubious code in contrib/seg.
Clean up dubious code in contrib/seg.

The restore() function assumed that the result of sprintf() with %e format
would necessarily contain an 'e', which is false: what if the supplied
number is an infinity or NaN?  If that did happen, we'd get a
null-pointer-dereference core dump.  The case appears impossible currently,
because seg_in() does not accept such values, and there are no seg-creating
functions that would create one.  But it seems unwise to rely on it never
happening in future.

Quite aside from that, the code was pretty ugly: it relied on modifying a
static format string when it could use a "*" precision argument, and it
used strtok() entirely gratuitously, and it stripped off trailing spaces
by hand instead of just not asking for them to begin with.

Coverity noticed the potential null pointer dereference (though I wonder
why it didn't complain years ago, since this code is ancient).

Since this is just code cleanup and forestalling a hypothetical future
bug, there seems no need for back-patching.

xinzweb/gpdb,ashwinstar/gpdb,xinzweb/gpdb,xinzweb/gpdb,greenplum-db/gpdb,50wu/gpdb,greenplum-db/gpdb,xinzweb/gpdb,jmcatamney/gpdb,adam8157/gpdb,lisakowen/gpdb,50wu/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,50wu/gpdb,50wu/gpdb,jmcatamney/gpdb,adam8157/gpdb,greenplum-db/gpdb,50wu/gpdb,lisakowen/gpdb,lisakowen/gpdb,ashwinstar/gpdb,lisakowen/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,adam8157/gpdb,50wu/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,adam8157/gpdb,xinzweb/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,ashwinstar/gpdb,lisakowen/gpdb,50wu/gpdb,lisakowen/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,adam8157/gpdb,xinzweb/gpdb,lisakowen/gpdb,jmcatamney/gpdb,adam8157/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,50wu/gpdb,greenplum-db/gpdb,jmcatamney/gpdb