- 1
$result = preg_replace("/(\d\d,\d\d)\d\d/", "$1", $result);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+157.6
$result = preg_replace("/(\d\d,\d\d)\d\d/", "$1", $result);
Не хотелось, а пришлось - это в большом потоке не очень хорошо структурированных данных так округляются числа, с четырёх до двух знаков после запятой.
+135.8
Xgetc(fp); /* the extension code */
for ( i = Xgetc(fp); i > 0; i-- ) Xgetc(fp);
while ( ( i = Xgetc(fp) ) > 0 ) {
for ( i = i ; i > 0; i-- ) Xgetc(fp);
}
Кусок из whirlgif - whirlgif.c
* This program reads in a sequence of single-image Gif format files and
* outputs a single multi-image Gif file, suitable for use as an animation.
Поубивал бы!
+151.4
http://suchen.mobile.de/fahrzeuge/showDetails.html?lang=ru&id=74773331&pageNumber=3&scopeId=C&sortOption.sortBy=searchNetGrossPrice&sortOption.sortOrder=ASCENDING&makeModelVariant1.makeId=17700&makeModelVariant1.modelId=13&makeModelVariant1.searchInFreetext=false&makeModelVariant2.searchInFreetext=false&makeModelVariant3.searchInFreetext=false&vehicleCategory=Car&segment=Car&minFirstRegistrationDate=1995-01-01&siteId=GERMANY&damageUnrepaired=ALSO_DAMAGE_UNREPAIRED&export=ALSO_EXPORT&customerIdsAsString=&tabNumber=2
небольшой такой запросик...
+142
[root@v6704 debug]# make
[ 1%] Generating moc_wordplugin.cxx
Scanning dependencies of target gluxi_plugin_word
[ 1%] Building CXX object src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/wordplugin.o
/home/gluxi/src/plugins/word/wordplugin.cpp: In member function ‘virtual bool WordPlugin::parseMessage(gloox::Stanza*)’:
/home/gluxi/src/plugins/word/wordplugin.cpp:104: error: ‘class gloox::Stanza’ has no member named ‘addAttribute’
/home/gluxi/src/plugins/word/wordplugin.cpp:105: error: ‘class gloox::Stanza’ has no member named ‘finalize’
/home/gluxi/src/plugins/word/wordplugin.cpp:106: error: ‘class gloox::Stanza’ has no member named ‘xml’
/home/gluxi/src/plugins/word/wordplugin.cpp:136: error: ‘class gloox::Stanza’ has no member named ‘addAttribute’
/home/gluxi/src/plugins/word/wordplugin.cpp:137: error: ‘class gloox::Stanza’ has no member named ‘finalize’
make[2]: *** [src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/wordplugin.o] Error 1
make[1]: *** [src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/all] Error 2
make: *** [all] Error 2
продолжаем говнокодить
+139
debug]# cmake ..
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.3.4
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found OpenSSL: /usr/lib/libssl.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Finding plugins in /home/gluxi/src/plugins
-- -> Found plugin: word
-- -> Found plugin: net
-- -> Found plugin: webstatus
-- -> Found plugin: muc
-- -> Found plugin: config
-- -> Found plugin: core
-- -> Found plugin: misc
-- -> Found plugin: user
-- -> Found plugin: alias
-- -> Found plugin: admin
-- PluginLoader generated
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gluxi/debug
не понятно
+142
case MOTO_ACCY_IOCTL_SET_CHARGER_LOAD_LINE:
/* Copy the load line setting from user space */
retval = copy_from_user ((void *)&data, (void *)arg, sizeof(data));
/* If the copy failed, return an error */
if (retval != 0)
{
retval = -EFAULT;
}
/* Else, configure the hardware for the requested load line setting */
else
{
/* Acquire the lock to prevent changes to connected_accessories */
spin_lock (&connected_lock);
/* Verify that the 3G fast charger is connected */
if (ACCY_BITMASK_ISSET(connected_accessories, MOTO_ACCY_TYPE_CHARGER_FAST_3G))
{
/* This charger is the only charger that supports an adjustable load line */
/* TBD */
}
/* Else, the appropriate charger type is not connected */
else
{
/* Return error: No such device */
retval = -ENODEV;
}
/* Release the lock for connected_accessories */
spin_unlock (&connected_lock);
}
break;
+145.4
индокод:
#ifdef PRINT_DEBUG_INFO
#define DBG_PRINT if(1) printf
#else
#define DBG_PRINT if(0) printf
#endif
Индокод - макрос для вкл-выкл дебажной печати.
+130
function showMenu() {
var isShowMenu = false;
isShowMenu = true;
isShowMenu = true;
if (isShowMenu) { ... }
}
сгенерированный код такой сгенерированный..
+140.7
%define is64bit %(test `grep -o '(.*)' /etc/SuSE-release` = "(x86_64)" && echo 1 || echo 0)
спек сборки одного rpm
до uname парни не догадались
−107.4
w := ord(CHar(Pbyte(Pointer(Integer(IN_BUFFER)+ inpos))^));
s := ord(Char(Pbyte(Pointer(Integer(IN_BUFFER)+ inpos + 1))^));
PByte(Pointer(Integer(out_buf)+ outpos))^ := w and 255; {?????? ?? ?????? ??????}
PByte(Pointer(Integer(out_buf)+ outpos + 1))^ := w shr 8;
PByte(Pointer(Integer(out_buf)+ outpos))^ := PByte(Pointer(Integer(out_buf)+ outpos))^ or ((W and 15) shl 4);
доступ к указателям как к массивам