emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/tree-sitter ddae8d4a13 5/5: Change malloc to xmalloc in treesit.


From: Yuan Fu
Subject: feature/tree-sitter ddae8d4a13 5/5: Change malloc to xmalloc in treesit.c
Date: Mon, 17 Oct 2022 20:14:35 -0400 (EDT)

branch: feature/tree-sitter
commit ddae8d4a13d58720a3118355fabc225a9d907160
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Change malloc to xmalloc in treesit.c
    
    * src/treesit.c (Ftreesit_parser_set_included_ranges): Change malloc
    to xmalloc.
---
 src/treesit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/treesit.c b/src/treesit.c
index 60280e0289..5994f6c263 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -1335,8 +1335,7 @@ is nil, the PARSER is to parse the whole buffer.  */)
       if (list_length (ranges) > UINT32_MAX)
        xsignal (Qargs_out_of_range, list2 (ranges, Flength (ranges)));
       uint32_t len = (uint32_t) list_length (ranges);
-      /* FIXME: We should test the return value of malloc below.  */
-      TSRange *treesit_ranges = malloc (sizeof(TSRange) * len);
+      TSRange *treesit_ranges = xmalloc (sizeof(TSRange) * len);
       struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
 
       for (int idx = 0; !NILP (ranges); idx++, ranges = XCDR (ranges))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]