Skip to content

Commit 03b9654

Browse files
committed
Update dictionary initializer syntax and fix a memory leak.
1 parent d1a61d6 commit 03b9654

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

source/base/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define OFFICIAL_VERSION_STRING "3.7.1"
4646
#define OFFICIAL_VERSION_NUMBER 371
4747

48-
#define POV_RAY_PRERELEASE "x.dictionary.8877181"
48+
#define POV_RAY_PRERELEASE "x.dictionary.8877243"
4949

5050
#if (POV_RAY_IS_AUTOBUILD == 1) && ((POV_RAY_IS_OFFICIAL == 1) || (POV_RAY_IS_SEMI_OFFICIAL == 1))
5151
#ifdef POV_RAY_PRERELEASE

source/parser/parser_tokenizer.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,8 @@ void Parser::Read_Symbol()
13811381
{
13821382
case ARRAY_ID_TOKEN:
13831383
{
1384-
dictIndex = NULL;
1384+
if (dictIndex)
1385+
POV_FREE (dictIndex);
13851386

13861387
Skip_Spaces();
13871388
c = Echo_getc();
@@ -1442,7 +1443,8 @@ void Parser::Read_Symbol()
14421443

14431444
case DICTIONARY_ID_TOKEN:
14441445
{
1445-
dictIndex = NULL;
1446+
if (dictIndex)
1447+
POV_FREE (dictIndex);
14461448

14471449
Skip_Spaces();
14481450
c = Echo_getc();
@@ -3664,6 +3666,7 @@ Parser::SYM_TABLE *Parser::Parse_Dictionary_Declare()
36643666
SYM_TABLE *newDictionary;
36653667
SYM_ENTRY *newEntry;
36663668
bool oldParseRawIdentifiers;
3669+
char *dictIndex;
36673670

36683671
newDictionary = Create_Sym_Table (true);
36693672

@@ -3682,7 +3685,22 @@ Parser::SYM_TABLE *Parser::Parse_Dictionary_Declare()
36823685
Expectation_Error ("dictionary element identifier");
36833686
newEntry = Add_Symbol (newDictionary, Token.Token_String, IDENTIFIER_TOKEN);
36843687

3685-
GET (EQUALS_TOKEN);
3688+
GET (COLON_TOKEN);
3689+
3690+
if (!Parse_RValue (IDENTIFIER_TOKEN, &(newEntry->Token_Number), &(newEntry->Data), newEntry, false, false, true, true, false, MAX_NUMBER_OF_TABLES))
3691+
Expectation_Error("RValue");
3692+
3693+
Parse_Comma();
3694+
END_CASE
3695+
3696+
CASE (LEFT_SQUARE_TOKEN)
3697+
dictIndex = Parse_C_String();
3698+
newEntry = Add_Symbol (newDictionary, dictIndex, IDENTIFIER_TOKEN);
3699+
POV_PARSER_ASSERT (newDictionary->namesAreCopies);
3700+
POV_FREE (dictIndex);
3701+
3702+
GET (RIGHT_SQUARE_TOKEN);
3703+
GET (COLON_TOKEN);
36863704

36873705
if (!Parse_RValue (IDENTIFIER_TOKEN, &(newEntry->Token_Number), &(newEntry->Data), newEntry, false, false, true, true, false, MAX_NUMBER_OF_TABLES))
36883706
Expectation_Error("RValue");

unix/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.1-x.dictionary.8877181
1+
3.7.1-x.dictionary.8877243

0 commit comments

Comments
 (0)