diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-07-14 17:53:58 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-07-14 17:53:58 +0000 |
commit | ab68fef4c19627a20b2bbe1df65f1e84d1ac8038 (patch) | |
tree | 913f6e08f830eec301002979f2d06f415175d691 /pjlib | |
parent | ff87677dd830abf1c0ab6e68e53026423b6117f3 (diff) |
Slight optimization in GUID generation for Win32 (removed unnecessary copy before encoding to string)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2140 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r-- | pjlib/src/pj/guid_win32.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/pjlib/src/pj/guid_win32.c b/pjlib/src/pj/guid_win32.c index d28a3ddb..42186ce0 100644 --- a/pjlib/src/pj/guid_win32.c +++ b/pjlib/src/pj/guid_win32.c @@ -39,17 +39,15 @@ PJ_INLINE(void) hex2digit(unsigned value, char *p) *p++ = hex[ (value & 0x0F) ]; } -static void guid_to_str( const GUID *guid, pj_str_t *str ) +static void guid_to_str( GUID *guid, pj_str_t *str ) { unsigned i; - GUID guid_copy; - const unsigned char *src = (const unsigned char*)&guid_copy; + const unsigned char *src = (const unsigned char*)guid; char *dst = str->ptr; - pj_memcpy(&guid_copy, guid, sizeof(*guid)); - guid_copy.Data1 = pj_ntohl(guid_copy.Data1); - guid_copy.Data2 = pj_ntohs(guid_copy.Data2); - guid_copy.Data3 = pj_ntohs(guid_copy.Data3); + guid->Data1 = pj_ntohl(guid->Data1); + guid->Data2 = pj_ntohs(guid->Data2); + guid->Data3 = pj_ntohs(guid->Data3); for (i=0; i<16; ++i) { hex2digit( *src, dst ); |