2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

dynamic-string: New function ds_swap().

This commit is contained in:
Ben Pfaff
2010-01-28 13:11:39 -08:00
parent 9397a13f60
commit e83fd21330
2 changed files with 12 additions and 2 deletions

View File

@@ -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