[PATCH] Packet streams: make packet_error[] const correct.

Kp <[email protected]> Sun, 22 Jun 2008 13:04:14 -0500
Newsgroups gmane.network.silc.devel
Message-ID <[email protected]>
When data is never intentionally modified, marking it as const allows 
the compiler to place it in a read only segment so that wild writes 
cannot accidentally modify it.

The array of character pointers is never changed, so make the pointers
constant.  The attached patch should be applicable via "git am" against 
the tip of silc.1.1.branch, currently at 
4d26d9f598384d7cd49c6238ea4a81b9f4e6f212.

_______________________________________________________________________
Info:    https://lists.silcnet.org/mailman/listinfo/silc-announce
Archive: https://lists.silcnet.org/pipermail/silc-announce
FAQ:     http://silcnet.org/support/faq/
0001-Packet-streams-make-packet_error-const-correct.patch (text/plain, 846 B)
From 4c2976675a33674d211798243191bc034a6e64ce Mon Sep 17 00:00:00 2001
From: [email protected] <[email protected]>
Date: Sun, 1 Jun 2008 12:13:22 -0500
Subject: [PATCH] Packet streams: make packet_error[] const correct.

The array of character pointers is never changed, so make the pointers
constant.
---
 lib/silccore/silcpacket.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c
index 251ee73..8748370 100644
--- a/lib/silccore/silcpacket.c
+++ b/lib/silccore/silcpacket.c
@@ -621,7 +621,7 @@ void silc_packet_engine_stop(SilcPacketEngine engine)
   silc_free(engine);
 }
 
-static const char *packet_error[] = {
+static const char *const packet_error[] = {
   "Cannot read from stream",
   "Cannot write to stream",
   "Packet MAC failed",
-- 
1.5.5.4