diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 00:27:03 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 00:27:03 +0000 |
commit | 1029ac96b16fc2df80f9ee32521aa3ec889700cb (patch) | |
tree | 17462903499c958c62c0440ac07bb27ea04b2857 /ppapi | |
parent | b80895132b81ce26bd5dfe0b169a9972b11f1227 (diff) | |
download | chromium_src-1029ac96b16fc2df80f9ee32521aa3ec889700cb.zip chromium_src-1029ac96b16fc2df80f9ee32521aa3ec889700cb.tar.gz chromium_src-1029ac96b16fc2df80f9ee32521aa3ec889700cb.tar.bz2 |
PNaCl: Simplify IRT wrapper a little by removing a global variable
There is no need for the temporary interface struct to be assembled in
a global variable, ppapi_hook.
This also removes a use of memcpy(). memcpy() is not available in
this context because this file isn't linked against libc. It only
works because the compiler inlines the memcpy() call.
BUG=none
TEST=PNaCl tests in browser_tests
Review URL: https://codereview.chromium.org/20508002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c index 76bc4d5..e7f725c 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c @@ -66,11 +66,6 @@ static int wrap_ppapi_start(const struct PP_StartFunctions *funcs) { return (*real_irt_ppapi_hook.ppapi_start)(&wrapped_ppapi_methods); } -static struct nacl_irt_ppapihook ppapi_hook = { - wrap_ppapi_start, - NULL -}; - size_t __pnacl_irt_interface_wrapper(const char *interface_ident, void *table, size_t tablesize) { /* @@ -93,16 +88,14 @@ size_t __pnacl_irt_interface_wrapper(const char *interface_ident, return 0; } /* - * Copy the portion of the ppapihook interface that is not wrapped. - */ - ppapi_hook.ppapi_register_thread_creator = - real_irt_ppapi_hook.ppapi_register_thread_creator; - /* * Copy the interface structure into the client. */ - if (sizeof ppapi_hook <= tablesize) { - memcpy(table, &ppapi_hook, sizeof ppapi_hook); - return sizeof ppapi_hook; + struct nacl_irt_ppapihook *dest = table; + if (sizeof *dest <= tablesize) { + dest->ppapi_start = wrap_ppapi_start; + dest->ppapi_register_thread_creator = + real_irt_ppapi_hook.ppapi_register_thread_creator; + return sizeof *dest; } return 0; } |