Here are two small code clean-up in initdb and win32_shmem.

pg_char_to_encoding() was redundant in initdb because
pg_valid_server_encoding() returns the same result if the encoding is valid,

Changes in win32_shmem suppress the following warnings.
| pg_shmem.c: In function `PGSharedMemoryCreate':
| pg_shmem.c:137: warning: long unsigned int format, Size arg (arg 2)
| pg_shmem.c:159: warning: long unsigned int format, Size arg (arg 2)


*** initdb.c.orig       Mon Mar 19 01:50:43 2007
--- initdb.c    Wed Mar 28 10:02:42 2007
*************** get_encoding_id(char *encoding_name)
*** 709,716 ****
  
        if (encoding_name && *encoding_name)
        {
!               if ((enc = pg_char_to_encoding(encoding_name)) >= 0 &&
!                       pg_valid_server_encoding(encoding_name) >= 0)
                        return encodingid_to_string(enc);
        }
        fprintf(stderr, _("%s: \"%s\" is not a valid server encoding name\n"),
--- 709,715 ----
  
        if (encoding_name && *encoding_name)
        {
!               if ((enc = pg_valid_server_encoding(encoding_name)) >= 0)
                        return encodingid_to_string(enc);
        }
        fprintf(stderr, _("%s: \"%s\" is not a valid server encoding name\n"),


*** win32_shmem.c.orig  Wed Mar 28 10:17:14 2007
--- win32_shmem.c       Wed Mar 28 10:16:36 2007
*************** PGSharedMemoryCreate(Size size, bool mak
*** 136,142 ****
        if (!hmap)
                ereport(FATAL,
                                (errmsg("could not create shared memory 
segment: %lu", GetLastError()),
!                                errdetail("Failed system call was 
CreateFileMapping(size=%lu, name=%s)", size, szShareMem)));
  
        /*
         * If the segment already existed, CreateFileMapping() will return a
--- 136,142 ----
        if (!hmap)
                ereport(FATAL,
                                (errmsg("could not create shared memory 
segment: %lu", GetLastError()),
!                                errdetail("Failed system call was 
CreateFileMapping(size=%lu, name=%s)", (unsigned long) size, szShareMem)));
  
        /*
         * If the segment already existed, CreateFileMapping() will return a
*************** PGSharedMemoryCreate(Size size, bool mak
*** 158,164 ****
                if (!hmap)
                        ereport(FATAL,
                                        (errmsg("could not create shared memory 
segment: %lu", GetLastError()),
!                                        errdetail("Failed system call was 
CreateFileMapping(size=%lu, name=%s)", size, szShareMem)));
  
                if (GetLastError() == ERROR_ALREADY_EXISTS)
                        ereport(FATAL,
--- 158,164 ----
                if (!hmap)
                        ereport(FATAL,
                                        (errmsg("could not create shared memory 
segment: %lu", GetLastError()),
!                                        errdetail("Failed system call was 
CreateFileMapping(size=%lu, name=%s)", (unsigned long) size, szShareMem)));
  
                if (GetLastError() == ERROR_ALREADY_EXISTS)
                        ereport(FATAL,


Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to