Closed Bug 296873 Opened 20 years ago Closed 20 years ago

Spagetti if-else statements instead of clean switch in RFC822Token(izer)

Categories

(Grendel Graveyard :: Protocols, defect)

x86
Linux
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: himicos, Assigned: himicos)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050511 none/0.0
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050511 none/0.0

The code in RFC822Tokenizer/RFC822Token in package storage.addressparser uses
long if-else if statements, instead of a clean switch-case syntax.

Reproducible: Always
--> himicos
Assignee: rj.keller → himicos
my first, so be gentle
:)
RJ, please review. Patch affects RFC822Token(izer).java
More to come...
> -    if (this.token_type == SPECIAL_CHAR)
> -    {
> +      switch(this.token_type) {
> +      case SPECIAL_CHAR:
>        System.out.print("Special");

Your switch statement and case statements should be indented lower.

 
>      // This while loop is the main body of the parser.
> -    while ((parse_state != AT_END)&&(this.sstr.currentIndex() < len))
> -    {
> +      while ((parse_state != AT_END)&&(this.sstr.currentIndex() < len)) {
>        int indx1, indx2;

Why is the while loop moved?


> -      }
> -      else if (parse_state == IN_COMMENT)
> -      {
> +              break;
> +          case IN_COMMENT:
>          indx1 = this.sstr.currentIndex();
>          t_char = this.sstr.nextChar();
>          parse_state = skipComment();

this indenting is really messed up :).

Other than that, code looks good! r=me with those changes. I'll make those
changes real quick before checkin. It'll be quicker than you making another patch.

Thanks for the contribution! Even small things are greatly appreciated!
Attached patch final patchSplinter Review
Attachment #185510 - Attachment is obsolete: true
Fix checked in -> http://bonsai.mozilla.org/showcheckins.cgi?&treeid=Grendel
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: