mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
Conflicts: Makefile cmd-list-commands.c cmd-suspend-client.c job.c tmux.h xmalloc.c
This commit is contained in:
		
							
								
								
									
										9
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								format.c
									
									
									
									
									
								
							@@ -17,6 +17,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
@@ -267,7 +268,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
 | 
			
		||||
 | 
			
		||||
	/* Expand the buffer and copy in the value. */
 | 
			
		||||
	while (*len - *off < valuelen + 1) {
 | 
			
		||||
		*buf = xrealloc(*buf, 2, *len);
 | 
			
		||||
		*buf = xreallocarray(*buf, 2, *len);
 | 
			
		||||
		*len *= 2;
 | 
			
		||||
	}
 | 
			
		||||
	memcpy(*buf + *off, value, valuelen);
 | 
			
		||||
@@ -298,7 +299,7 @@ format_expand(struct format_tree *ft, const char *fmt)
 | 
			
		||||
	while (*fmt != '\0') {
 | 
			
		||||
		if (*fmt != '#') {
 | 
			
		||||
			while (len - off < 2) {
 | 
			
		||||
				buf = xrealloc(buf, 2, len);
 | 
			
		||||
				buf = xreallocarray(buf, 2, len);
 | 
			
		||||
				len *= 2;
 | 
			
		||||
			}
 | 
			
		||||
			buf[off++] = *fmt++;
 | 
			
		||||
@@ -326,7 +327,7 @@ format_expand(struct format_tree *ft, const char *fmt)
 | 
			
		||||
			continue;
 | 
			
		||||
		case '#':
 | 
			
		||||
			while (len - off < 2) {
 | 
			
		||||
				buf = xrealloc(buf, 2, len);
 | 
			
		||||
				buf = xreallocarray(buf, 2, len);
 | 
			
		||||
				len *= 2;
 | 
			
		||||
			}
 | 
			
		||||
			buf[off++] = '#';
 | 
			
		||||
@@ -339,7 +340,7 @@ format_expand(struct format_tree *ft, const char *fmt)
 | 
			
		||||
				s = format_lower[ch - 'a'];
 | 
			
		||||
			if (s == NULL) {
 | 
			
		||||
				while (len - off < 3) {
 | 
			
		||||
					buf = xrealloc(buf, 2, len);
 | 
			
		||||
					buf = xreallocarray(buf, 2, len);
 | 
			
		||||
					len *= 2;
 | 
			
		||||
				}
 | 
			
		||||
				buf[off++] = '#';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user