ObjFW  Diff

Differences From Artifact [c9c58ea96b]:

To Artifact [91d5f2f808]:


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#import "OFStream.h"
#import "OFString.h"
#import "OFDataArray.h"
#import "OFExceptions.h"
#import "macros.h"

#import "asprintf.h"

@implementation OFStream
#ifndef _WIN32
+ (void)initialize
{
	if (self == [OFStream class])
		signal(SIGPIPE, SIG_IGN);







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#import "OFStream.h"
#import "OFString.h"
#import "OFDataArray.h"
#import "OFExceptions.h"
#import "macros.h"

#import "of_asprintf.h"

@implementation OFStream
#ifndef _WIN32
+ (void)initialize
{
	if (self == [OFStream class])
		signal(SIGPIPE, SIG_IGN);
672
673
674
675
676
677
678
679
680

681
682
683
684
685
686
687
688
689
690
691
692

693
694
695
696
697
698
699

	return ret;
}

- (size_t)writeFormat: (OFString*)fmt
	withArguments: (va_list)args
{
	size_t len;
	char *t;


	if (fmt == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ((len = vasprintf(&t, [fmt cString], args)) == -1) {
		/*
		 * This is only the most likely error to happen. Unfortunately,
		 * there is no good way to check what really happened.
		 */
		@throw [OFOutOfMemoryException newWithClass: isa];
	}


	@try {
		return [self writeNBytes: len
			      fromBuffer: t];
	} @finally {
		free(t);
	}







<

>





|
<
<
<
<
|
<
>







672
673
674
675
676
677
678

679
680
681
682
683
684
685
686




687

688
689
690
691
692
693
694
695

	return ret;
}

- (size_t)writeFormat: (OFString*)fmt
	withArguments: (va_list)args
{

	char *t;
	int len;

	if (fmt == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];

	if ((len = of_vasprintf(&t, [fmt cString], args)) == -1)




		@throw [OFInvalidArgumentException newWithClass: isa

						       selector: _cmd];

	@try {
		return [self writeNBytes: len
			      fromBuffer: t];
	} @finally {
		free(t);
	}