@@ -140,11 +140,7 @@ mtbl_sorter_init(const struct mtbl_sorter_options *opt)
140140 if (s -> opt .pool != NULL ) {
141141 s -> pool = s -> opt .pool -> pool ;
142142 s -> rhandler = result_handler_init (_collect_readers_cb , s );
143- if (s -> rhandler == NULL ) {
144- entry_vec_destroy (& s -> vec );
145- reader_vec_destroy (& s -> readers );
146- return (NULL );
147- }
143+ assert (s -> rhandler != NULL );
148144 }
149145
150146 return (s );
@@ -198,31 +194,16 @@ _mtbl_sorter_write_chunk(struct entry_batch *b)
198194 ubuf_append (tmp_fname , (const uint8_t * ) "\x00" , 1 );
199195
200196 int fd = mkstemp ((char * ) ubuf_data (tmp_fname ));
201- if (fd < 0 ) {
202- ubuf_destroy (& tmp_fname );
203- return (NULL );
204- }
205-
197+ assert (fd >= 0 );
206198 int unlink_ret = unlink ((char * ) ubuf_data (tmp_fname ));
207- if (unlink_ret == -1 ) {
208- ubuf_destroy (& tmp_fname );
209- close (fd );
210- return (NULL );
211- }
212-
199+ assert (unlink_ret == 0 );
213200 ubuf_destroy (& tmp_fname );
214201
215202 struct mtbl_writer_options * wopt = mtbl_writer_options_init ();
216203 mtbl_writer_options_set_compression (wopt , MTBL_COMPRESSION_SNAPPY );
217204
218205 struct mtbl_writer * w = mtbl_writer_init_fd (fd , wopt );
219- if (w == NULL ) {
220- mtbl_writer_options_destroy (& wopt );
221- close (fd );
222- entry_vec_destroy (& b -> entries );
223- free (b );
224- return (NULL );
225- }
206+ assert (w != NULL );
226207
227208 mtbl_writer_options_destroy (& wopt );
228209
0 commit comments