This patch applied, except without the structure changes to nmblib.c
authorAndrew Bartlett <abartlet@samba.org>
Mon, 29 Oct 2001 08:12:44 +0000 (08:12 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 29 Oct 2001 08:12:44 +0000 (08:12 +0000)
Andrew Bartlett.

From kai@cmail.ru Mon Oct 29 18:50:42 2001
Date: Fri, 19 Oct 2001 17:26:06 +0300
From: Andrew V. Samoilov <kai@cmail.ru>
To: samba-technical@lists.samba.org
Subject: [patch]: makes some arrays const to be shared between processes

Hi!

This patch makes some arrays const. So these arrays go to text/rodata
segment and are shared between all of the processes which use shared
library with these arrays.

Regards,
Andrew V. Samoilov.

P.S. Please cc your answer to kai@cmail.ru,
I don't subscribed to this list.

ChangeLog:
* cliconnect.c (prots): Make const.
* clierror.c (rap_errmap): Likewise.
* nmblib.c (nmb_header_opcode_names): Likewise.
(lookup_opcode_name): Make opcode_namep const. Eliminate i.
* nterr.c (nt_err_code_struct): Typedef const.
* smberr.c (err_code_struct): Make const.
(err_classes): Likewise.
(This used to be commit cb84485a2b0e1fdcb6fa90e0bfb97e125ae1b3dd)

source3/libsmb/cliconnect.c
source3/libsmb/clierror.c
source3/libsmb/nmblib.c
source3/libsmb/nterr.c
source3/libsmb/smberr.c

index 680f30900ea310d97d9504505620d2f53dc30094..aae21cb6d9e3b5335d57b88ce03516ce1957747f 100644 (file)
@@ -24,7 +24,7 @@
 #include "includes.h"
 
 
-static  struct {
+static const struct {
     int prot;
     const char *name;
   }
index bcecc92d778e3482648ddc7f53aaa57dc641fb8a..fe793d4b0e36425ad0bc743bfec37a7986be44f0 100644 (file)
@@ -27,7 +27,7 @@
  RAP error codes - a small start but will be extended.
 *******************************************************/
 
-static struct
+static const struct
 {
   int err;
   char *message;
index d7bd7b49a0bd0567e42b3f1a8fa6282c58130db9..dc399248186b8a6b7299276218499632b7fe5c38 100644 (file)
@@ -25,7 +25,7 @@
 int num_good_sends = 0;
 int num_good_receives = 0;
 
-static struct opcode_names {
+static const struct opcode_names {
        char *nmb_opcode_name;
        int opcode;
 } nmb_header_opcode_names[] = {
@@ -42,9 +42,9 @@ static struct opcode_names {
 /****************************************************************************
  * Lookup a nmb opcode name.
  ****************************************************************************/
-static char *lookup_opcode_name( int opcode )
+static const char *lookup_opcode_name( int opcode )
 {
-  struct opcode_names *op_namep;
+  const struct opcode_names *op_namep;
   int i;
 
   for(i = 0; nmb_header_opcode_names[i].nmb_opcode_name != 0; i++) {
index 1f61e648c20ae498a1c056430e8d0f9811d0e7df..ab0a4256335a319bd7eb78ec6c448637dfedefd9 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "includes.h"
 
-typedef struct
+typedef const struct
 {
        char *nt_errstr;
        NTSTATUS nt_errcode;
index 0b59b5b1a518d16d1760fc09bdd169b48aeffea3..66256d2385dd3b847312225eb90f3bd1e6ed6a2e 100644 (file)
@@ -25,7 +25,7 @@
 /* error code stuff - put together by Merik Karman
    merik@blackadder.dsh.oz.au */
 
-typedef struct
+typedef const struct
 {
   char *name;
   int code;
@@ -125,7 +125,7 @@ err_code_struct hard_msgs[] = {
   {NULL,-1,NULL}};
 
 
-struct
+const struct
 {
   int code;
   char *class;