Skip to content

Fixes #104#105

Merged
smaret merged 4 commits intolime-rt:masterfrom
allegroLeiden:fix_104
Jul 12, 2016
Merged

Fixes #104#105
smaret merged 4 commits intolime-rt:masterfrom
allegroLeiden:fix_104

Conversation

@allegroLeiden
Copy link
Copy Markdown
Contributor

In this commit I have done the following:

  • In lime.h:
    • Added macros for the LAMBDA identification integers for collision partners.
  • In the function molinit():
    • Changed the name count (which must win some sort of an obscurity prize) to
      collPartIDs.
    • Added an s to the name collpartname.
    • Added a variable sizeI=200, dimensioned string to this size, and read this many
      characters into string with each fget.
    • Added a test for buffer overflow in reading the comment line of the collision
      partner ID, with an orderly exception for such cases.
    • Made use of the LAMBDA macros to make the choice for calculating nmol a bit more
      clear.

In this commit I have done the following:
  . In lime.h:
    . Added macros for the LAMBDA identification integers for collision partners.
  . In the function molinit():
    . Changed the name 'count' (which must win some sort of an obscurity prize) to
'collPartIDs'.
    . Added an 's' to the name 'collpartname'.
    . Added a variable sizeI=200, dimensioned 'string' to this size, and read this many
characters into 'string' with each fget.
    . Added a test for buffer overflow in reading the comment line of the collision
partner ID, with an orderly exception for such cases.
    . Made use of the LAMBDA macros to make the choice for calculating nmol a bit more
clear.
@smaret smaret added the bug label Jun 13, 2016
@smaret smaret added this to the Release 1.6 milestone Jun 13, 2016
@smaret smaret self-assigned this Jun 30, 2016
Comment thread src/molinit.c
fgets(string, sizeI, fp);
fscanf(fp,"%d\n", &collPartIDs[ipart]);

/* We want to test if the comment after the coll partner ID number is longer than the buffer size. To do this, we write a character - any character, as long as it is not \0 - to the last element of the buffer:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment after the collisional partner ID number used elsewhere in the code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The intent of this elaborate check is purely to avoid a cock-up if the comment line exceeds the buffer length. It is essentially an error trap.

@smaret
Copy link
Copy Markdown
Contributor

smaret commented Jul 11, 2016

Looks good to me, thanks. Could you please resolve the conflicts so I can merge the PR?

@allegroLeiden
Copy link
Copy Markdown
Contributor Author

It's ready.

@smaret smaret merged commit d9aeb51 into lime-rt:master Jul 12, 2016
@smaret smaret mentioned this pull request Jul 12, 2016
@allegroLeiden allegroLeiden deleted the fix_104 branch September 7, 2016 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants