mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 03:29:06 +00:00 
			
		
		
		
	It doesn't make much sense for a hash function to modify its argument, so const the hash input. BGP does it in a couple places, those cast away the const. Not great but not any worse than it was. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
		
			
				
	
	
		
			77 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
//
 | 
						|
// Transition hash key signatures to take their argument as const.
 | 
						|
// Does not handle headers or weirdly named hash functions.
 | 
						|
//
 | 
						|
@noconst disable optional_qualifier@
 | 
						|
identifier A;
 | 
						|
identifier func =~ ".*key$|.*key_make$|.*hash_make$|.*hash_keymake$|.*hash_key$|.*hash_key.*";
 | 
						|
@@
 | 
						|
 | 
						|
- func (void *A)
 | 
						|
+ func (const void *A)
 | 
						|
  { ... }
 | 
						|
 | 
						|
@ depends on noconst disable optional_qualifier @
 | 
						|
identifier noconst.A;
 | 
						|
identifier noconst.func;
 | 
						|
identifier b;
 | 
						|
type T;
 | 
						|
@@
 | 
						|
 | 
						|
func( ... ) {
 | 
						|
<...
 | 
						|
-  T b = A;
 | 
						|
+  const T b = A;
 | 
						|
...>
 | 
						|
  }
 | 
						|
 | 
						|
@ depends on noconst disable optional_qualifier @
 | 
						|
identifier noconst.A;
 | 
						|
identifier noconst.func;
 | 
						|
identifier b;
 | 
						|
type T;
 | 
						|
@@
 | 
						|
 | 
						|
func(...)
 | 
						|
  {
 | 
						|
<...
 | 
						|
-  T b = (T) A;
 | 
						|
+  const T b = A;
 | 
						|
...>
 | 
						|
  }
 | 
						|
 | 
						|
@ depends on noconst disable optional_qualifier @
 | 
						|
identifier noconst.A;
 | 
						|
identifier noconst.func;
 | 
						|
identifier b;
 | 
						|
type T;
 | 
						|
@@
 | 
						|
 | 
						|
func(...)
 | 
						|
  {
 | 
						|
<...
 | 
						|
-  T b;
 | 
						|
+  const T b;
 | 
						|
...
 | 
						|
   b = A;
 | 
						|
...>
 | 
						|
  }
 | 
						|
 | 
						|
@ depends on noconst disable optional_qualifier @
 | 
						|
identifier noconst.A;
 | 
						|
identifier noconst.func;
 | 
						|
identifier b;
 | 
						|
type T;
 | 
						|
@@
 | 
						|
 | 
						|
func(...)
 | 
						|
  {
 | 
						|
<...
 | 
						|
-  T b;
 | 
						|
+  const T b;
 | 
						|
...
 | 
						|
-  b = (T) A;
 | 
						|
+  b = A;
 | 
						|
...>
 | 
						|
  }
 |