Changes between Version 14 and Version 15 of Hacking


Ignore:
Timestamp:
02/16/11 10:07:17 (13 years ago)
Author:
angel_il
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Hacking

    v14 v15  
    3333'''This is right:''' 
    3434{{{ 
    35     /* 
    36      * This is a multi line comment, 
    37      * Delete '\n' char. 
    38      * Note that edit_delete() will not corrupt anything if called while 
    39      *   cursor position is EOF. 
    40      */ 
    41     (void) edit_delete (edit); 
    42  
    43      /*  This is a one line comment. Allocate additional memory.  */ 
    44      mem = (char *) malloc (memneed); 
    45  
    46     /** 
    47      * @brief This is a doxygen comment. 
    48      * 
    49      * This is a more detailed explanation of 
    50      * this simple function. 
    51      * 
    52      * @param[in]   param1     The parameter value of the function. 
    53      * 
    54      * @param[out]  result1    The result value of the function. 
    55      * 
    56      * @return              0 on success and -1 on error. 
    57      */ 
    58     int example (int param1, int *result1); 
    59  
    60 }}} 
    61  
    62 '''This is wrong:''' 
    63 {{{ 
    64     //This is a one line comment. 
    65  
    66     /*This is a one line comment.*/ 
    67  
    68     /* This is a multi line comment, 
    69        with some more words...*/ 
     35/* 
     36 * This is a multi line comment, 
     37 * Delete '\n' char. 
     38 * Note that edit_delete() will not corrupt anything if called while 
     39 *   cursor position is EOF. 
     40 */ 
     41(void) edit_delete (edit); 
     42 
     43/*  This is a one line comment. Allocate additional memory.  */ 
     44mem = (char *) malloc (memneed); 
     45 
     46/** 
     47 * @brief This is a doxygen comment. 
     48 * 
     49 * This is a more detailed explanation of 
     50 * this simple function. 
     51 * 
     52 * @param[in]   param1     The parameter value of the function. 
     53 * 
     54 * @param[out]  result1    The result value of the function. 
     55 * 
     56 * @return              0 on success and -1 on error. 
     57 */ 
     58int example (int param1, int *result1); 
     59 
     60}}} 
     61 
     62'''This is wrong:''' 
     63{{{ 
     64//This is a one line comment. 
     65 
     66/*This is a one line comment.*/ 
     67 
     68/* This is a multi line comment, 
     69   with some more words...*/ 
    7070 
    7171}}} 
     
    7878'''This is right:''' 
    7979{{{ 
    80     if (i == 0) 
    81  
    82 }}} 
    83 '''This is wrong:''' 
    84 {{{ 
    85     if ( i == 0 ) 
    86     if (0 == i) 
     80if (i == 0) 
     81 
     82}}} 
     83'''This is wrong:''' 
     84{{{ 
     85if ( i == 0 ) 
     86 
     87if (0 == i) 
    8788 
    8889}}} 
     
    9495'''This is right:''' 
    9596{{{ 
    96     do_example (int param1, int *result1); 
    97  
    98 }}} 
    99 '''This is wrong:''' 
    100 {{{ 
    101     do_example(int param1, int *result1); 
     97do_example (int param1, int *result1); 
     98 
     99}}} 
     100'''This is wrong:''' 
     101{{{ 
     102do_example(int param1, int *result1); 
    102103 
    103104}}} 
     
    113114'''This is right:''' 
    114115{{{ 
    115     if (xterm_flag && xterm_title) 
    116     { 
    117         path = strip_home_and_password (current_panel->cwd); 
     116if (xterm_flag && xterm_title) 
     117{ 
     118    path = strip_home_and_password (current_panel->cwd); 
    118119    ... 
    119     } 
    120  
     120} 
     121 
     122for (j = 0; j < 10; j++) 
     123{ 
     124    for (i = 0; str_options[i].opt_name != NULL; i++) 
     125        g_free (*str_options[i].opt_addr); 
     126} 
     127 
     128}}} 
     129'''This is wrong:''' 
     130{{{ 
     131if (xterm_flag && xterm_title) { 
     132    path = strip_home_and_password (current_panel->cwd); 
     133    ... 
     134} 
     135 
     136if (xterm_flag && xterm_title) 
     137{ 
     138    path = strip_home_and_password (current_panel->cwd); } 
     139 
     140for (k = 0; k < 10; k++) 
    121141    for (j = 0; j < 10; j++) 
    122     { 
    123142        for (i = 0; str_options[i].opt_name != NULL; i++) 
    124143            g_free (*str_options[i].opt_addr); 
    125     } 
    126  
    127 }}} 
    128 '''This is wrong:''' 
    129 {{{ 
    130     if (xterm_flag && xterm_title) { 
    131         path = strip_home_and_password (current_panel->cwd); 
    132     ... 
    133     } 
    134  
    135     if (xterm_flag && xterm_title) 
    136     { 
    137         path = strip_home_and_password (current_panel->cwd); } 
    138  
    139     for (k = 0; k < 10; k++) 
    140         for (j = 0; j < 10; j++) 
    141             for (i = 0; str_options[i].opt_name != NULL; i++) 
    142                 g_free (*str_options[i].opt_addr); 
    143144 
    144145}}} 
     
    158159        if (!dest || !*dest) 
    159160            goto cleanup; 
    160     ... 
    161     ... 
     161        ... 
     162        ... 
    162163    } 
    163164  ... 
     
    178179'''This is right:''' 
    179180{{{ 
    180     bytes = read (fd, &routine.pointer, sizeof (routine)); 
    181     if (bytes == -1 || (size_t) bytes < (sizeof (routine))) 
    182  
    183 }}} 
    184  
    185 '''This is wrong:''' 
    186 {{{ 
    187     if (bytes = read (fd, &routine.pointer, sizeof (routine)) == -1 || (size_t) bytes < (sizeof (routine))) 
    188  
    189     if (read (from_parent_fd, &i, sizeof (int)) != sizeof (int)) 
    190         return NULL; 
     181bytes = read (fd, &routine.pointer, sizeof (routine)); 
     182if (bytes == -1 || (size_t) bytes < (sizeof (routine))) 
     183 
     184}}} 
     185 
     186'''This is wrong:''' 
     187{{{ 
     188if (bytes = read (fd, &routine.pointer, sizeof (routine)) == -1 || (size_t) bytes < (sizeof (routine))) 
     189 
     190if (read (from_parent_fd, &i, sizeof (int)) != sizeof (int)) 
     191    return NULL; 
    191192 
    192193}}}