1. Список говнокодов пользователя rat4

    Всего: 35

  2. Си / Говнокод #11321

    +137

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    void
    meta_window_constrain (MetaWindow          *window,
                           MetaFrameBorders    *orig_borders,
                           MetaMoveResizeFlags  flags,
                           int                  resize_gravity,
                           const MetaRectangle *orig,
                           MetaRectangle       *new)
    {
      ConstraintInfo info;
    
      /* ... */
    
      setup_constraint_info (&info, window,  orig_borders, flags, resize_gravity, orig, new);
    
      /* ... */
    
      /* Ew, what an ugly way to do things.  Destructors (in a real OOP language,
       * not gobject-style--gobject would be more pain than it's worth) or
       * smart pointers would be so much nicer here.  *shrug*
       */
      if (!orig_borders)
        g_free (info.borders);
    }
    
    static void
    setup_constraint_info (/* ... */)
    {
      /* ... */
    
      /* Create a fake frame geometry if none really exists */
      if (orig_borders && !window->fullscreen)
        info->borders = orig_borders;
      else
        info->borders = g_new0 (MetaFrameBorders, 1);
    
      /* ... */
    }

    http://git.gnome.org/browse/mutter/tree/src/core/constraints.c

    rat4, 29 Июня 2012

    Комментарии (28)
  3. Куча / Говнокод #10973

    +131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    >>>+[[-]>>[-]++>+>+++++++[<++++>>++<-]++>>+>+>+++++[>++>++++++<<-]+>>>,<++[[>[
    ->>]<[>>]<<-]<[<]<+>>[>]>[<+>-[[<+>-]>]<[[[-]<]++<-[<+++++++++>[<->-]>>]>>]]<<
    ]<]<[[<]>[[>]>>[>>]+[<<]<[<]<+>>-]>[>]+[->>]<<<<[[<<]<[<]+<<[+>+<<-[>-->+<<-[>
    +<[>>+<<-]]]>[<+>-]<]++>>-->[>]>>[>>]]<<[>>+<[[<]<]>[[<<]<[<]+[-<+>>-[<<+>++>-
    [<->[<<+>>-]]]<[>+<-]>]>[>]>]>[>>]>>]<<[>>+>>+>>]<<[->>>>>>>>]<<[>.>>>>>>>]<<[
    >->>>>>]<<[>,>>>]<<[>+>]<<[+<<]<]

    Yo dawg I heard you like brainfuck so we put brainfuck in your brainfuck so you can brainfuck while you brainfuck

    rat4, 15 Июня 2012

    Комментарии (28)
  4. Си / Говнокод #10294

    +138

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    typedef int32_t wl_fixed_t;
    
    //было:
    static inline double wl_fixed_to_double(wl_fixed_t f)
    {
      return (double) f / 256.0;
    }
    
    //стало:
    static inline double wl_fixed_to_double(wl_fixed_t f)
    {
      union {
        double d;
        int64_t i;
      } u;
    
      u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
    
      return u.d - (3LL << 43);
    }

    Заоптимизировали...

    rat4, 16 Мая 2012

    Комментарии (23)
  5. Си / Говнокод #10123

    +130

    1. 1
    2. 2
    3. 3
    #define FOO     /* a macro with a multiline comment
                     * gets the linecount wrong
                     */

    Splint will miscalculate line numbers after multi-line comments in macro definitions. For example,

    rat4, 30 Апреля 2012

    Комментарии (10)
  6. Си / Говнокод #10009

    +138

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    //
    		switch (cwin->cpref->shuffle) {
    			case TRUE:
    				last = g_list_last(cwin->cstate->rand_track_refs);
    				if ((!cwin->cstate->curr_rand_ref) || (last && (cwin->cstate->curr_rand_ref == last->data))){
    					path = get_next_unplayed_random_track(cwin);
    					if (!path)
    						rand_unplayed = TRUE;
    				}
    				else path = get_next_random_ref_track(cwin);
    				break;
    			case FALSE:
    				path = get_next_sequential_track(cwin);
    				if (!path) seq_last = TRUE;
    				break;
    			default:
    				break;
    		}

    буль...

    rat4, 21 Апреля 2012

    Комментарии (1)
  7. Java / Говнокод #9931

    +91

    1. 1
    2. 2
    3. 3
    4. 4
    public class HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
    		extends AbstractPatternNodeVisitor {
    
    	boolean ohYesItHas = false;

    rat4, 12 Апреля 2012

    Комментарии (7)
  8. Си / Говнокод #9718

    +133

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // for cdio:
    #include <cdio.h>
    #include <cdio_unconfig.h> # remove *all* symbols libcdio defines
    
    // Add back in the ones you want your program
    #include <config.h>

    But now what about the problem that there are common preprocessor symbols in config_cdio.h that an application may want to define in a different manner, like PACKAGE_NAME?
    For this, there is yet another header, <cdio/cdio_unconfig.h>.

    rat4, 20 Марта 2012

    Комментарии (1)
  9. C++ / Говнокод #9603

    +997

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    static std::string printFloatNumber(float num,bool friendly=false)
    {
    	std::ostringstream out ;
    
    	if(friendly)
    	{
    		char tmp[100] ;
    		std::string units[4] = { "B/s","KB/s","MB/s","GB/s" } ;
    
    		int k=0 ;
    		while(num >= 800.0f && k<5)
    			num /= 1024.0f,++k;
    
    		sprintf(tmp,"%3.2f %s",num,units[k].c_str()) ;
    		return std::string(tmp) ;
    	}
    	else
    	{
    		out << num ;
    		return out.str() ;
    	}
    }

    Исходники RetroShare - это просто шедевр!

    rat4, 04 Марта 2012

    Комментарии (11)
  10. C++ / Говнокод #9602

    +156

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    #ifdef P3TURTLE_DEBUG
    	std::cerr << "performing search. OwnId = " << mLinkMgr->getOwnId() << std::endl ;
    #endif
    	while(mLinkMgr->getOwnId() == "")
    	{
    		std::cerr << "... waitting for connect manager to form own id." << std::endl ;
    #ifdef WIN32
    		Sleep(1000) ;
    #else
    		sleep(1) ;
    #endif
    	}

    trunk/libretroshare/src/turtle/p3turtle.cc

    rat4, 04 Марта 2012

    Комментарии (1)
  11. C++ / Говнокод #8880

    +1001

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    void Object::destroy ()
    {
      evas_object_del (o);
      
      // do a suicide as the delete operator isn't public available
      // the reason is that the C design below is a suicide design :-(
      //delete (this); // TODO: why does this make problems sometimes???
    }

    source: trunk/BINDINGS/cxx/elementaryxx/src/Object.cpp @ 65926

    rat4, 04 Января 2012

    Комментарии (4)