aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src
diff options
context:
space:
mode:
authorVitaliy Batichko <[email protected]>2010-11-23 17:08:01 +0200
committerVitaliy Batichko <[email protected]>2010-12-08 20:15:50 +0200
commitad5b84bd154e27d9e4db3af12b8b4326c564b2bf (patch)
treec71a2607537d15259ec4cb2fd8224bd02af34c71 /lib/erl_interface/src
parent1d82ce2e4466980e5c360b54722952a30bc3ae50 (diff)
downloadotp-ad5b84bd154e27d9e4db3af12b8b4326c564b2bf.tar.gz
otp-ad5b84bd154e27d9e4db3af12b8b4326c564b2bf.tar.bz2
otp-ad5b84bd154e27d9e4db3af12b8b4326c564b2bf.zip
Add char (~c) type parameters to ei_format
Diffstat (limited to 'lib/erl_interface/src')
-rw-r--r--lib/erl_interface/src/misc/ei_format.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/erl_interface/src/misc/ei_format.c b/lib/erl_interface/src/misc/ei_format.c
index b35421d4b2..96203a0d15 100644
--- a/lib/erl_interface/src/misc/ei_format.c
+++ b/lib/erl_interface/src/misc/ei_format.c
@@ -47,6 +47,7 @@
* array of unions.
*/
union arg {
+ char c;
char* s;
long l;
unsigned long u;
@@ -224,6 +225,7 @@ static int pquotedatom(const char** fmt, ei_x_buff* x)
/*
* The format letters are:
* a - An atom
+ * c - A character
* s - A string
* i - An integer
* l - A long integer
@@ -240,6 +242,10 @@ static int pformat(const char** fmt, union arg** args, ei_x_buff* x)
res = ei_x_encode_atom(x, (*args)->s);
(*args)++;
break;
+ case 'c':
+ res = ei_x_encode_char(x, (*args)->c);
+ (*args)++;
+ break;
case 's':
res = ei_x_encode_string(x, (*args)->s);
(*args)++;
@@ -396,6 +402,9 @@ static int read_args(const char* fmt, va_list ap, union arg **argp)
return -1; /* Error, string not complete */
}
switch (*p++) {
+ case 'c':
+ args[i++].c = (char) va_arg(ap, int);
+ break;
case 'a':
case 's':
args[i++].s = va_arg(ap, char*);