X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdynamic-string.c;fp=lib%2Fdynamic-string.c;h=c3338180d250aed389c432031598fde630cb8afa;hb=e83fd213300e19ad1da4e1ddbc049d4b858d34e8;hp=7f5e3fbaac44b830d0cf9e527f0b3abc9fedbcb1;hpb=9397a13f60a477a4244a305fd88845fd5dc36b22;p=openvswitch diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 7f5e3fba..c3338180 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -242,6 +242,15 @@ ds_destroy(struct ds *ds) free(ds->string); } +/* Swaps the content of 'a' and 'b'. */ +void +ds_swap(struct ds *a, struct ds *b) +{ + struct ds temp = *a; + *a = *b; + *b = temp; +} + /* Writes the 'size' bytes in 'buf' to 'string' as hex bytes arranged 16 per * line. Numeric offsets are also included, starting at 'ofs' for the first * byte in 'buf'. If 'ascii' is true then the corresponding ASCII characters