]> granicus.if.org Git - recode/commitdiff
request.c: slight simplification of code to handle malloc failure
authorReuben Thomas <rrt@sc3d.org>
Sat, 27 Jan 2018 14:14:15 +0000 (14:14 +0000)
committerReuben Thomas <rrt@sc3d.org>
Sun, 28 Jan 2018 22:41:22 +0000 (22:41 +0000)
src/request.c

index cc976a7193f10d48dcb9c4cc6d79b39145f1468a..02c34938ecef80d2f3d7937ffe9c63a721e4cad2 100644 (file)
@@ -73,14 +73,11 @@ add_work_character (RECODE_REQUEST request, int character)
       new_work_string = (char *)
        realloc (request->work_string, request->work_string_allocated);
       if (new_work_string)
-       {
-         request->work_string = new_work_string;
-         request->work_string[request->work_string_length++] = character;
-       }
-      /* else, the diagnostic gets truncated, no need to fuss about it.  */
+        request->work_string = new_work_string;
+      else
+        return; /* the diagnostic gets truncated, no need to fuss about it.  */
     }
-  else
-    request->work_string[request->work_string_length++] = character;
+  request->work_string[request->work_string_length++] = character;
 }
 
 /*----------------------------------.