Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tests/ruby/main.c

Issue 5622003: Restructure the structs/unions involved in SRPC argument passing. This will... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/quake/nacl_file.c ('k') | tests/srpc/cat.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright 2009 The Native Client Authors. All rights reserved. 1 /* Copyright 2009 The Native Client Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can 2 * Use of this source code is governed by a BSD-style license that can
3 * be found in the LICENSE file. */ 3 * be found in the LICENSE file. */
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 #include <nacl/nacl_srpc.h> 7 #include <nacl/nacl_srpc.h>
8 #include "ruby-1.8.6-p368/ruby.h" 8 #include "ruby-1.8.6-p368/ruby.h"
9 9
10 int initialized = 0; 10 int initialized = 0;
(...skipping 27 matching lines...) Expand all
38 NaClSrpcArg **in_args, 38 NaClSrpcArg **in_args,
39 NaClSrpcArg **out_args, 39 NaClSrpcArg **out_args,
40 NaClSrpcClosure *done) { 40 NaClSrpcClosure *done) {
41 41
42 /* TODO(krasin): MAKE IT THREAD-SAFE */ 42 /* TODO(krasin): MAKE IT THREAD-SAFE */
43 if (!initialized) { 43 if (!initialized) {
44 ruby_init(); 44 ruby_init();
45 rb_eval_string(INIT_RUBY_SCRIPT); 45 rb_eval_string(INIT_RUBY_SCRIPT);
46 initialized = 1; 46 initialized = 1;
47 } 47 }
48 rb_eval_string(in_args[0]->u.sval); 48 rb_eval_string(in_args[0]->arrays.str);
49 VALUE result = rb_eval_string("$stdout_logger.get_string()"); 49 VALUE result = rb_eval_string("$stdout_logger.get_string()");
50 50
51 /* 51 /*
52 * Strdup must be used because the SRPC layer frees the string passed to it. 52 * Strdup must be used because the SRPC layer frees the string passed to it.
53 */ 53 */
54 out_args[0]->u.sval = strdup(StringValuePtr(result)); 54 out_args[0]->arrays.str = strdup(StringValuePtr(result));
55 55
56 rpc->result = NACL_SRPC_RESULT_OK; 56 rpc->result = NACL_SRPC_RESULT_OK;
57 done->Run(done); 57 done->Run(done);
58 } 58 }
59 59
60 /* 60 /*
61 * Export the method as taking no arguments and returning one integer. 61 * Export the method as taking no arguments and returning one integer.
62 */ 62 */
63 NACL_SRPC_METHOD("rubyEval:s:s", RubyEval); 63 NACL_SRPC_METHOD("rubyEval:s:s", RubyEval);
OLDNEW
« no previous file with comments | « tests/quake/nacl_file.c ('k') | tests/srpc/cat.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698